MSSQL Objective Questions and Answers for Beginners Set-2
1. Which SQL function is used to find the minimum value in a column?
Explanation: The MIN() function is used to find the minimum value in a column. It is often used with numeric or date columns to retrieve the smallest value in the specified column.
2. Which SQL statement is used to create a new database?
Explanation: The CREATE DATABASE statement is used to create a new database in SQL Server. You can specify the name of the new database and other optional parameters.
3. What is the purpose of the SQL DISTINCT keyword?
Explanation: The DISTINCT keyword is used with the SELECT statement to retrieve only the unique or distinct values from the specified column(s) in the result set.
4. Which SQL statement is used to create a new table?
Explanation: The CREATE statement is used to create a new table in a database. You need to specify the table name, column names, and their data types in the CREATE statement.
5. What is the purpose of the SQL LIKE operator?
Explanation: The LIKE operator is used in SQL queries to search for patterns in string values. It allows you to perform partial matching using wildcard characters such as % and _.
6. Which SQL function is used to find the maximum value in a column?
Explanation: The MAX() function is used to find the maximum value in a column. It is often used with numeric or date columns to retrieve the largest value in the specified column.
7. What is the purpose of the SQL NULL keyword?
Explanation: The NULL keyword is used in SQL to represent the absence of a value in a column. It indicates that the column does not have any data or the data is unknown
8. Which SQL statement is used to delete a table from the database?
Explanation: The DROP TABLE statement is used to delete a table and remove it from the database permanently.
9. What is the purpose of the SQL COUNT() function?
Explanation: The COUNT() function is used to count the number of rows in a table. It can also be used with the DISTINCT keyword to count the number of distinct values in a column.
10. Which SQL statement is used to change the data type of a column in a table?
Explanation: The ALTER COLUMN statement is used to modify the data type of a column in a table. It allows you to change the data type to a different one that is compatible with the existing data.
11. Which SQL function is used to find the length of a string?
Explanation: The CHAR_LENGTH() function is used to find the length of a string in terms of the number of characters in the string.
12. Which SQL function is used to convert a string to uppercase characters?
Explanation: The UPPER() function is used to convert a string to uppercase characters. It returns the string with all characters converted to uppercase.
13. What is the purpose of the SQL LIMIT clause?
Explanation: The SELECT keyword is used to retrieve data from a database table. It allows you to specify the columns you want to retrieve and the conditions to filter the data.
14. What is the purpose of the SQL GROUP BY clause when used with the GROUP_CONCAT() function?
Explanation: When the GROUP BY clause is used with the GROUP_CONCAT() function, it is used to concatenate values from multiple rows into a single string.
15. What is the purpose of the SQL TRUNCATE TABLE statement?
Explanation: The TRUNCATE TABLE statement is used to remove all rows from a table without logging individual row deletions. It is faster and uses fewer system resources compared to the DELETE statement.
Rate Your Experience
: 89
: 1
Last updated in November, 2024
Quick Access