SQL Server Query MCQs

Question 1: Which of the following T-SQL creates a database?

Question 2: Considering the Employee table below, how will you delete a record whose EmpId is 5?

Question 3: From the Employee table below, how do you get the average salary of each department?

Question 4: Which of the following is a valid T-SQL statement to add a new column to a table?

Question 5: How do you get the total number of employees whose DeptId is 1 from the Employee table given below:

Question 6: Identify some of the properties of sub-queries in SQL Server

Question 7: Identify the syntax to delete a column Address from the Employee table

Question 8: Considering the following Employee table, write the query that fetches the FirstName whose EmpId is 5.

Question 9: Refer to the Employee table below and write a query to fetch the EmpId, FirstName, and LastName of the employee with the first name being in descending order.

Question 10: Consider the Employee table with EmpId, FirstName, LastName, Email, DeptId columns and the Department table with DeptId and DeptName columns. Write a query to fetch the FirstName, LastName, and department names.