SQL Question and Answers PDF

Page 1

SQL Question and Answers PDF 1. Question: Retrieve all records from a table named Employees Answer: SELECT * FROM Employees;

2. Question: Retrieve the names of employees whose salary is greater than $50,000 from the Employees table. Answer: SELECT Name FROM Employees WHERE Salary > 50000;

3. Question: Retrieve the total number of employees in each department from the Employees table. Answer: SELECT Department, COUNT(*) AS Total_Employees FROM Employees GROUP BY Department;

4. Question: Update the salary of an employee with ID 101 to $60,000 in the Employees table. Answer: UPDATE Employees SET Salary = 60000 WHERE ID = 101;

5. Question: Delete all employees from the Employees table who have resigned (status is 'Resigned')? Answer: DELETE FROM Employees WHERE Status = 'Resigned';


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
SQL Question and Answers PDF by Data Science Training In Pune - Technogeeks - Issuu