MCQ | SQL – Select, Clause, Order By, Insert, Update and Delete Statements

SQL Select, Clause, Order By, Insert, Update and Delete Statements MCQ: This section contains the Multiple-Choice Questions & Answers on SQL Select, Clause, Order By, Insert, Update and Delete Statements.
Submitted by Anushree Goswami, on September 26, 2021

1. Which one is not the OPTIONAL Clause in SELECT statement?

  1. WHERE
  2. ORDER BY
  3. HAVE
  4. HAVING

Answer: C) HAVE

Explanation:

WHERE, ORDER BY and HAVING are all OPTIONAL Clauses in SELECT statement.

Discuss this Question


2. Which statement is TRUE about the WHERE Clause?

  1. In order to retrieve rows, WHERE Clause is used.
  2. In order to group the rows, WHERE Clause is used.
  3. In order to select the defined groups, WHERE Clause is used.
  4. In order to return the rows, WHERE Clause is used.

Answer: A) In order to retrieve rows, WHERE Clause is used

Explanation:

In order to retrieve rows, WHERE Clause is used.

Discuss this Question


3. Which statement is TRUE about the GROUP BY Clause?

  1. In order to retrieve rows, GROUP BY Clause is used.
  2. In order to group the rows that share the same property, GROUP BY Clause is used.
  3. In order to select the defined groups, GROUP BY Clause is used.
  4. In order to return the rows, GROUP BY Clause is used.

Answer: B) In order to group the rows that share the same property, GROUP BY Clause is used

Explanation:

In order to group the rows that share the same property, GROUP BY Clause is used.

Discuss this Question


4. Which statement is TRUE about the HAVING Clause?

  1. In order to group the rows, HAVING Clause is used.
  2. In order to return the rows, HAVING Clause is used.
  3. In order to select the defined groups by the GROUP BY Clause, HAVING Clause is used.
  4. None of the above

Answer: C) In order to select the defined groups by the GROUP BY Clause, HAVING Clause is used

Explanation:

In order to select the defined groups by the GROUP BY Clause, HAVING Clause is used.

Discuss this Question


5. Which statement is TRUE about the ORDER BY Clause?

  1. In order to return the rows in a specific order, ORDER BY Clause is used.
  2. In order to group the rows, ORDER BY Clause is used.
  3. In order to select the defined groups, ORDER BY Clause is used.
  4. None of the above

Answer: A) In order to return the rows in a specific order, ORDER BY Clause is used

Explanation:

In order to return the rows in a specific order, ORDER BY Clause is used.

Discuss this Question


6. Which of the following clause cannot be optional in SQL SELECT Statement?

  1. WHERE
  2. GROUP BY
  3. ORDER BY
  4. None of the above

Answer: D) None of the above

Explanation:

WHERE, GROUP BY and ORDER BY all are optional clauses in SQL SELECT Statement.

Discuss this Question


7. Which of the following clause is optional in SQL SELECT Statement?

  1. SELECT
  2. FROM
  3. HAVING
  4. None of the above

Answer: C) HAVING

Explanation:

HAVING Clause is optional in SQL SELECT Statement.

Discuss this Question


8. Which clause is used to retrieve a unique element from the table?

  1. SELECT UNIQUE
  2. SELECT DISTINCT
  3. Both A) and B)
  4. None of the above

Answer: C) Both A) and B)

Explanation:

SELECT UNIQUE and SELECT DISTINCT clauses are used to retrieve a unique element from a table.

Discuss this Question


9. What is the functionality of SQL COUNT?

  1. It returns the no of record of table
  2. It returns the no of record of database
  3. It returns the no of record of row
  4. It returns the no of record of column

Answer: A) It returns the no of record of table

Explanation:

SQL COUNT returns the no of record of table.

Discuss this Question


10. In SQL SELECT COUNT, one needs to specify the –

  1. Column Name
  2. Row Name
  3. Table Name
  4. None of the above

Answer: A) Column Name

Explanation:

In SQL SELECT COUNT, one needs to specify the Column Name.

Discuss this Question


11. The SELECT TOP statement shows the limited number of:

  1. Rows
  2. Columns
  3. Tables
  4. None of the above

Answer: A) Rows

Explanation:

The SELECT TOP statement shows the limited number of records or rows.

Discuss this Question


12. Select the correct syntax of SELECT TOP clause?

  1. SELECT TOP name
  2. SELECT TOP column
  3. SELECT TOP FROM
  4. SELECT TOP Number

Answer: D) SELECT TOP Number

Explanation:

The correct syntax of SELECT TOP clause is SELECT TOP Number.

Discuss this Question


13. Using the SQL first() function, one can return the ____ value of the selected column.

  1. First
  2. Second
  3. Third
  4. Last

Answer: A) First

Explanation:

Using the SQL first() function, one can return the first value of the selected column.

Discuss this Question


14. Using the SQL last() function, one can return the ______ value of the selected column.

  1. First
  2. Second
  3. Third
  4. Last

Answer: D) Last

Explanation:

Using the SQL last() function, one can return the last value of the selected column.

Discuss this Question


15. Using SQL SELECT RANDOM() function, one can return the random –

  1. Table
  2. Database
  3. Row
  4. Column

Answer: C) Row

Explanation:

Using SQL SELECT RANDOM() function, one can return the random row.

Discuss this Question


16. In order to assign a random name to a column or table, which SQL SELECT Clause is used?

  1. FROM
  2. WHERE
  3. HAVING
  4. AS

Answer: D) AS

Explanation:

In order to assign a random name to a column or table, SQL SELECT AS Clause is used.

Discuss this Question


17. Which function combines the two different columns?

  1. ADD
  2. MERGE
  3. CONCAT
  4. None of the above

Answer: C) CONCAT

Explanation:

CONCAT() function, combines the two different columns.

Discuss this Question


18. What is the difference between HAVING and WHERE clause?

  1. HAVING clause is used in column operation whereas WHERE clause is used in row operation.
  2. HAVING clause is post-filter whereas WHERE clause is pre-filter.
  3. HAVING clause filters the groups whereas WHERE clauses filter the single record of the table.
  4. All of the above

Answer: D) All of the above

Explanation:

The differences between HAVING and WHERE clauses are:

  1. HAVING clause is used in column operation whereas WHERE clause is used in row operation.
  2. HAVING clause is post-filter whereas WHERE clause is pre-filter.
  3. HAVING clause filters the groups whereas WHERE clauses filter the single record of the table.

Discuss this Question


19. What is the difference between MIN and MAX function?

  1. MIN function is used to show the minimum data and MAX function is used to show the maximum data.
  2. MIN function is used to show the maximum data and MAX function is used to show the minimum data.
  3. Both of the above
  4. None of the above

Answer: A) MIN function is used to show the minimum data and MAX function is used to show the maximum data

Explanation:

MIN function is used to show the minimum data and MAX function is used to show the maximum data.

Discuss this Question


20. In order to sort the records according to the columns, which clause is used?

  1. HAVING
  2. GROUP BY
  3. ORDER BY
  4. None of the above

Answer: C) ORDER BY

Explanation:

ORDER BY clause is used to sort the records according to the columns.

Discuss this Question


21. By default, sorting by ORDER BY clause is done in which order?

  1. Ascending
  2. Descending

Answer: A) Ascending

Explanation:

By default, sorting by ORDER BY clause is done in ascending order.

Discuss this Question


22. What is the keyword of the Ascending and Descending?

  1. ASCE, DESC
  2. ASC, DES
  3. ASCE, DES
  4. ASC, DESC

Answer: D) ASC, DESC

Explanation:

ASC, DESC are the keywords of the ascending and descending.

Discuss this Question


23. SQL INSERT is used to insert a –

  1. Single or Multiple record
  2. Single or Multiple database
  3. Single or Multiple table
  4. None of the above

Answer: A) Single or Multiple record

Explanation:

SQL INSERT is used to insert a single or multiple records in the table.

Discuss this Question


24. In order to insert a row directly in the table, which command is used?

  1. INSERT IN
  2. INSERT INSIDE
  3. INSERT UNDER
  4. INSERT INTO

Answer: D) INSERT INTO

Explanation:

INSERT INTO command is used to insert a row directly in the table.

Discuss this Question


25. In order to update one table using another table and join condition, which statement is used.

  1. SQL UPDATE INTO
  2. SQL UPDATE JOIN
  3. SQL JOIN
  4. SQL JOIN UPDATE

Answer: B) SQL UPDATE JOIN

Explanation:

SQL UPDATE JOIN is used to update one table using another table and join condition.

Discuss this Question


26. SQL DELETE can be used to delete,

  1. Rows
  2. Database
  3. View
  4. All of the above

Answer: D) All of the above

Explanation:

SQL DELETE can be used to delete Rows, Database and View using specific SQL clauses.

Discuss this Question


27. What is the clause to delete all rows from the table?

  1. SQL DELETE ALL ROWS Table_Name;
  2. SQL DELETE ROWS Table_Name;
  3. DELETE FROM ALL ROWS Table_Name;
  4. DELETE FROM Table_Name;

Answer: D) DELETE FROM Table_Name;

Explanation:

DELETE FROM Table_Name is used to delete all rows from the table.

Discuss this Question


28. In order to delete duplicate rows from the table, which keyword is used?

  1. DELETE
  2. DISTINCT
  3. FROM
  4. WHERE

Answer: B) DISTINCT

Explanation:

DISTINCT keyword is used to delete duplicate rows from the table.

Discuss this Question


29. In order to delete the database, which keyword is used?

  1. DROP
  2. DELETE
  3. ALTER
  4. None of the above

Answer: A) DROP

Explanation:

DROP keyword is used to delete the database.

Discuss this Question


30. Which of the following keyword is used to delete the Join?

  1. DELETE
  2. ON
  3. WHERE
  4. All of the above

Answer: D) All of the above

Explanation:

DELETE, ON, WHERE and few other keywords are used to delete the Join.

Discuss this Question





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.