SQL Query:: Select Empid, Empname, Age, Address From Employee Where Empid 1004
SQL Query:: Select Empid, Empname, Age, Address From Employee Where Empid 1004
a) Write the SELECT command to display the details of the employee with empid as 1004.
SQL Query:
SELECT empId, empName, Age, Address from Employee WHERE empId = 1004;
Result:
b) Write the SELECT command to display all the records of table Employees.
SQL Query:
SELECT * from Employee;
Result:
c) Write the SELECT command to display all the records of the employee whose name starts with the
character ‘R’.
SQL Query:
SELECT * from Employee WHERE empName LIKE ‘R%’;
Result:
d) Write a SELECT command to display id, age and name of the employees with their age in both
ascending and descending order.
SQL Query:
SELECT empId, empName, Age from Employee ORDER BY Age;
Result:
SELECT empId, empName, Age from Employee ORDER BY Age Desc;
Result:
e) Write the SELECT command to calculate the total amount of salary on each employee from the
below Emp table.
Emp table:
SQL Query:
SELECT empName, SUM(Salary) from Emp GROUP BY empName;
Result: