MSSQL Objective Questions and Answers for Professionals Set-1
1. What is the purpose of the SQL Server CHECK constraint?
Explanation: The SQL Server CHECK constraint is used to enforce a rule for the acceptable range of values in a column. It ensures that the data entered into the column meets a specific condition or set of conditions.
2. Which of the following is used to retrieve only unique rows from the result set in SQL Server?
Explanation: In SQL Server, the keyword "DISTINCT" is used to retrieve only unique rows from the result set of a SELECT query. It eliminates duplicate rows, showing each distinct row only once in the output.
3. What is the purpose of the SQL Server function GETDATE()?
Explanation: The GETDATE() function in SQL Server is used to obtain the current date and time from the system. It is commonly used to record timestamps or to perform date and time-based calculations.
4. Which of the following SQL Server indexes physically reorder the data rows in a table?
Explanation: A clustered index in SQL Server physically reorders the data rows in the table based on the indexed column. Each table can have only one clustered index.
5. What is the purpose of the SQL Server keyword "TOP" in a SELECT statement?
Explanation: The "TOP" keyword in SQL Server is used to specify the maximum number of rows to return in the result set of a SELECT query.
6. In SQL Server, what is the purpose of the LTRIM() function?
Explanation: The LTRIM() function in SQL Server is used to remove leading spaces from a string.
7. Which of the following is a system database in SQL Server that stores metadata and configuration information?
Explanation: The "master" database in SQL Server is a system database that stores metadata and configuration information about the SQL Server instance.
8. What is the purpose of the SQL Server function DATEDIFF()?
Explanation: The DATEDIFF() function in SQL Server is used to calculate the difference between two dates or times
9. Which SQL Server backup type includes both data and transaction log changes since the last backup?
Explanation: A differential backup in SQL Server includes all data and transaction log changes since the last full backup.
10. In SQL Server, which of the following is used to retrieve a specific part of a datetime value, such as the year, month, or day?
Explanation: The DATEPART() function in SQL Server is used to retrieve a specific part (e.g., year, month, day) of a datetime value.
11. What is the purpose of the SQL Server function COALESCE()?
Explanation: The COALESCE() function in SQL Server is used to return the first non-null expression among its arguments.
12. Which SQL Server join type returns only the rows that have matching values in both tables?
Explanation: An INNER JOIN in SQL Server returns only the rows that have matching values in both tables being joined.
13. What is the purpose of the SQL Server function ROW_NUMBER()?
Explanation: The ROW_NUMBER() function in SQL Server is used to assign a unique number to each row in the result set based on the specified column's ordering.
14. Which of the following SQL Server statements is used to permanently remove rows from a table?
Explanation: The DELETE statement in SQL Server is used to permanently remove rows from a table.
15. What is the purpose of the SQL Server function @@ROWCOUNT?
Explanation: The @@ROWCOUNT function in SQL Server is used to retrieve the number of rows affected by the last SQL statement.
Rate Your Experience
: 89
: 1