0% found this document useful (0 votes)
9 views2 pages

SQL Assignment Solutions Explained

Ha ha ha

Uploaded by

divyanshnayyar55
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

SQL Assignment Solutions Explained

Ha ha ha

Uploaded by

divyanshnayyar55
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Assignment Answers

SQL Assignment Answers

Below are the answers to the 10 SQL questions based on the provided employee dataset.

1. Retrieve all records from the employee table.

SELECT * FROM employee;

2. Retrieve the name and salary of employees.

SELECT Name, Salary FROM employee;

3. Retrieve the details of employees whose salary is greater than 50,000.

SELECT * FROM employee

WHERE Salary > 50000;

4. Retrieve the details of employees who live in 'Delhi'.

SELECT * FROM employee

WHERE City = 'Delhi';

5. Retrieve the details of employees whose age is between 25 and 35.

SELECT * FROM employee

WHERE Age BETWEEN 25 AND 35;

6. Retrieve the details of employees whose name starts with 'A'.

SELECT * FROM employee

WHERE Name LIKE 'A%';

7. Retrieve the total number of employees.

SELECT COUNT(*) AS Total_Employees FROM employee;

8. Retrieve the average salary of employees.

SELECT AVG(Salary) AS Average_Salary FROM employee;


SQL Assignment Answers

9. Retrieve the highest and lowest salary from the employee table.

SELECT MAX(Salary) AS Highest_Salary, MIN(Salary) AS Lowest_Salary

FROM employee;

10. Retrieve the details of employees in descending order of their salary.

SELECT * FROM employee

ORDER BY Salary DESC;

End of Assignment

You might also like