MCQ CH - 6
MCQ CH - 6
**
- a) Structured Query Language
- b) Sequential Query Language
- c) Standard Query Language
- d) Simple Query Language
- **Answer:** a) Structured Query Language
8. **Which of the following SQL statements is used to retrieve data from a database?**
- a) GET
- b) SELECT
- c) EXTRACT
- d) RETRIEVE
- **Answer:** b) SELECT
11. **Which SQL statement is used to add new data into a database?**
- a) ADD
- b) APPEND
- c) INSERT
- d) UPDATE
- **Answer:** c) INSERT
12. **Which keyword is used to eliminate duplicate rows from the result set in SQL?**
- a) NO DUPLICATE
- b) DISTINCT
- c) UNIQUE
- d) DIFFERENT
- **Answer:** b) DISTINCT
13. **What type of join returns all records when there is a match in either left or right
table?**
- a) INNER JOIN
- b) OUTER JOIN
- c) LEFT JOIN
- d) RIGHT JOIN
- **Answer:** b) OUTER JOIN
14. **Which of the following is a valid SQL comment?**
- a) //
- b) --
- c) ##
- d) **
- **Answer:** b) --
15. **Which SQL clause is used to group rows that have the same values in specified
columns?**
- a) GROUP BY
- b) ORDER BY
- c) WHERE
- d) HAVING
- **Answer:** a) GROUP BY
16. **Which SQL clause is used to filter groups after the GROUP BY clause?**
- a) WHERE
- b) HAVING
- c) FILTER
- d) SELECT
- **Answer:** b) HAVING
19. **Which SQL keyword is used to retrieve all records from a table?**
- a) GET
- b) RETRIEVE
- c) SELECT
- d) FETCH
- **Answer:** c) SELECT
21. **Which SQL statement is used to remove existing records from a table?**
- a) REMOVE
- b) DELETE
- c) DROP
- d) CLEAR
- **Answer:** b) DELETE
22. **Which SQL function is used to find the minimum value in a column?**
- a) LEAST
- b) MIN
- c) SMALLEST
- d) LOWEST
- **Answer:** b) MIN
23. **What is the result of a SQL SELECT statement with a missing WHERE clause?**
- a) All rows are returned
- b) No rows are returned
- c) Only unique rows are returned
- d) An error is returned
- **Answer:** a) All rows are returned
24. **Which SQL keyword is used to retrieve only unique values from a column?**
- a) UNIQUE
- b) DIFFERENT
- c) DISTINCT
- d) SEPARATE
- **Answer:** c) DISTINCT
25. **Which clause is used to specify the condition to join two tables in SQL?**
- a) WHERE
- b) JOIN
- c) ON
- d) WITH
- **Answer:** c) ON
26. **Which command is used to change the structure of a table after it has been created?**
- a) MODIFY TABLE
- b) CHANGE TABLE
- c) ALTER TABLE
- d) UPDATE TABLE
- **Answer:** c) ALTER TABLE
27. **Which SQL function is used to calculate the average value of a column?**
- a) TOTAL
- b) AVERAGE
- c) MEAN
- d) AVG
- **Answer:** d) AVG
30. **Which SQL command is used to modify the values of existing records in a table?**
- a) ALTER
- b) CHANGE
- c) MODIFY
- d) UPDATE
- **Answer:** d) UPDATE
31. **Which of the following is a set function in SQL?**
- a) COUNT
- b) JOIN
- c) SELECT
- d) WHERE
- **Answer:** a) COUNT
33. **Which SQL clause is used to specify the columns to be displayed in the result set?**
- a) FROM
- b) SELECT
- c) WHERE
- d) DISPLAY
- **Answer:** b) SELECT
36. **Which of the following SQL keywords is used to retrieve data from a database?**
- a) RETRIEVE
- b) FETCH
- c)
SELECT
- d) GET
- **Answer:** c) SELECT
38. **Which SQL function is used to count the number of rows in a table?**
- a) NUMBER
- b) TOTAL
- c) COUNT
- d) SUM
- **Answer:** c) COUNT
39. **Which SQL keyword is used to sort the result set in ascending order?**
- a) ASC
- b) SORT
- c) ORDER
- d) UP
- **Answer:** a) ASC
40. **Which SQL clause is used to specify the table to query data from?**
- a) SELECT
- b) FROM
- c) WHERE
- d) JOIN
- **Answer:** b) FROM
41. **What is the result of the SQL expression: SELECT COUNT(*) FROM table_name?**
- a) The sum of values in a column
- b) The total number of rows in the table
- c) The number of unique values in a column
- d) The maximum value in a column
- **Answer:** b) The total number of rows in the table
42. **Which of the following statements is used to add a new row to a table in SQL?**
- a) ADD ROW
- b) INSERT INTO
- c) ADD INTO
- d) CREATE ROW
- **Answer:** b) INSERT INTO
45. **What does the SQL statement ALTER TABLE table_name ADD column_name
data_type do?**
- a) Deletes a column from a table
- b) Changes the data type of a column
- c) Adds a new column to a table
- d) Renames a column in a table
- **Answer:** c) Adds a new column to a table
47. **Which SQL command is used to remove all rows from a table without removing the table
structure?**
- a) DROP
- b) DELETE
- c) REMOVE
- d) TRUNCATE
- **Answer:** d) TRUNCATE