SQL Server Questions and Answers – Basic SQL – 1

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “Basic SQL – 1”.

1. Which SQL function is used to count the number of rows in a SQL query?
a) COUNT()
b) NUMBER()
c) SUM()
d) COUNT(*)
View Answer

Answer: d
Explanation: COUNT(*) takes null value row in to consideration.

2. Which SQL keyword is used to retrieve a maximum value?
a) MOST
b) TOP
c) MAX
d) UPPER
View Answer

Answer: c
Explanation: The MAX() function returns the largest value of the selected column.

3. Which of the following SQL clauses is used to DELETE tuples from a database table?
a) DELETE
b) REMOVE
c) DROP
d) CLEAR
View Answer

Answer: a
Explanation: The SQL DELETE Query is used to delete the existing records from a table.
advertisement
advertisement

4. ___________removes all rows from a table without logging the individual row deletions.
a) DELETE
b) REMOVE
c) DROP
d) TRUNCATE
View Answer

Answer: d
Explanation: TRUNCATE statement is a Data Definition Language (DDL) operation that marks the extents of a table for deallocation.

5. Which of the following is not a DDL command?
a) UPDATE
b) TRUNCATE
c) ALTER
d) None of the Mentioned
View Answer

Answer: a
Explanation: Data definition language (DDL) commands enable you to perform the following tasks:Create, alter, and drop schema objects.

6. Which of the following are TCL commands?
a) UPDATE and TRUNCATE
b) SELECT and INSERT
c) GRANT and REVOKE
d) ROLLBACK and SAVEPOINT
View Answer

Answer: d
Explanation: Transaction control commands manage changes made by DML commands. These SQL commands are used for managing changes affecting the data.

7. ________________ is not a category of SQL command.
a) TCL
b) SCL
c) DCL
d) DDL
View Answer

Answer: b
Explanation: SQL commands can be used not only for searching the database but also to perform various other functions.They are DDL,DML,TCL and DCL.
advertisement

8. If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default ______________
a) ASC
b) DESC
c) There is no default value
d) None of the mentioned
View Answer

Answer: a
Explanation: ASC is the default sort order. Null values are treated as the lowest possible values.

9. Which of the following statement is true?
a) DELETE does not free the space containing the table and TRUNCATE free the space containing the table
b) Both DELETE and TRUNCATE free the space containing the table
c) Both DELETE and TRUNCATE does not free the space containing the table
d) DELETE free the space containing the table and TRUNCATE does not free the space containing the table
View Answer

Answer: a
Explanation: The SQL TRUNCATE command is used to delete all the rows from the table and free the space containing the table.
advertisement

10. What is the purpose of the SQL AS clause?
a) The AS SQL clause is used to change the name of a column in the result set or to assign a name to a derived column
b) The AS clause is used with the JOIN clause only
c) The AS clause defines a search condition
d) All of the mentioned
View Answer

Answer: a
Explanation: SQL Aliases are defined for columns and tables. Basically aliases are created to make the column selected more readable.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.