0% found this document useful (0 votes)
17 views

SQL Query:: Select Empid, Empname, Age, Address From Employee Where Empid 1004

SQL

Uploaded by

Innie
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

SQL Query:: Select Empid, Empname, Age, Address From Employee Where Empid 1004

SQL

Uploaded by

Innie
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

 

#51) Based on the given table, solve the following queries.


Employee table

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:

You might also like