0% found this document useful (0 votes)
9 views1 page

SQL Answers

Uploaded by

Ananya Besra
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 views1 page

SQL Answers

Uploaded by

Ananya Besra
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
You are on page 1/ 1

TIME: 30 MINS SQL F.M.

- 15
Employee (id,name,designation,contact,salary) Department (id, Dept_Name,city)
Based on above table write SQL queries:
1. Select all employee details:
SELECT * FROM Employee;

2. Select all department details:


SELECT * FROM Department;

3. Retrieve employee names and their contact numbers:


SELECT name, contact FROM Employee;

4. Display the name and salary of employees with a salary greater than 50,000:
SELECT name, salary FROM Employee WHERE salary > 50000;

5. List employee name,designation and city, working in "Kolkata":


SELECT Employee.name, Employee.designation, Department.city
FROM Employee,Department
where Employee.id = Department.id AND Department.city = 'Kolkata';

6. Sort the records according to the Department Name.


SELECT * from Employee, Department
where Employee.id = Department.id order by Dept_Name;

7. Retrieve the department names and cities of employees earning more than 40,000:
SELECT Employee.name, Department.Dept_Name, Department.city
FROM Employee,Department where Employee.id = Department.id AND Employee.salary > 40000;

8. Display employees sorted by salary in descending order:


SELECT * FROM Employee ORDER BY salary DESC;

9. Find the Name and salaries of the Employees of Accounts department:


SELECT Employee .Name, Employee.salary,
FROM Employee,Department
where Employee.id = Department.id AND Department.Dept_Name=’Accounts’;

10. Retrieve employee details along with their department name:


SELECT Employee.name, Employee.designation, Department.Dept_Name
FROM Employee, Department where Employee.id = Department.id;

11. List employees whose names start with the letter "A":
SELECT * FROM Employee
WHERE name LIKE 'A%';

12. Fetch the details of employees working in departments located in "Delhi":


SELECT Employee.name, Employee.designation, Department.Dept_Name, Department.city
FROM Employee,Department where Employee.id = Department.id AND
Department.city = 'Delhi';

13. List employees whose names ends with the letter "C":
SELECT * FROM Employee
WHERE name LIKE '%C';

14. Find the details of Employees having contact no. 12356988


Select * from Employee where contact=12356998;

15. Show the records of employees and sort them according to their designation.
Select * from Employees order by designation;

You might also like