SQL MCQs – Data Manipulation and Querying

Data manipulation and querying are crucial aspects of working with databases. SQL commands like INSERT, UPDATE, DELETE, and SELECT allow you to interact with and modify database content efficiently. Understanding the nuances of these commands, such as filtering data with WHERE, using aggregate functions (e.g., SUM, AVG), and applying joins to combine data from multiple tables, is essential for effective database management. Preparing for these topics with multiple-choice questions (MCQs) enhances your knowledge and problem-solving skills, ensuring confidence during interviews.

1.) Which command is used to add new rows to a table?

A) INSERT
B) UPDATE
C) ALTER
D) ADD

Answer: Option A

Explanation: The INSERT command is used to add new records to a table.

2.) What is the purpose of the UPDATE command?

A) Insert new records
B) Modify existing records
C) Delete records
D) Create tables

Answer: Option B

Explanation: UPDATE modifies existing rows in a table based on specified conditions.

3.) How do you remove a specific record from a table?

A) DROP
B) TRUNCATE
C) DELETE
D) REMOVE

Answer: Option C

Explanation: DELETE removes specific rows from a table based on a condition.

4.) Which clause is used to filter rows in a SELECT query?

A) FILTER
B) GROUP BY
C) HAVING
D) WHERE

Answer: Option D

Explanation: WHERE specifies conditions to filter records in a query.

5.) What does the SELECT * statement do?

A) Selects all columns from a table
B) Selects unique rows
C) Selects specific columns
D) Selects all tables

Answer: Option A

Explanation: SELECT * retrieves all columns from a specified table.

6.) How do you add a new column to an existing table?

A) ALTER TABLE
B) ADD COLUMN
C) UPDATE TABLE
D) INSERT COLUMN

Answer: Option A

Explanation: ALTER TABLE adds a new column to an existing table.

7.) How do you combine data from multiple tables?

A) GROUP BY
B) UNION
C) JOIN
D) CONNECT

Answer: Option C

Explanation: JOIN combines data from two or more tables based on a related column.

8.) Which clause is used to combine rows with the same values?

A) ORDER BY
B) GROUP BY
C) UNION
D) DISTINCT

Answer: Option B

Explanation: GROUP BY is used to combine rows with identical values.

9.) Which command is used to remove duplicate rows in a query result?

A) UNIQUE
B) DISTINCT
C) GROUP BY
D) FILTER

Answer: Option B

Explanation: DISTINCT eliminates duplicate records in the result set.

10.) How do you sort query results?

A) GROUP BY
B) SORT BY
C) ORDER BY
D) FILTER

Answer: Option C

Explanation: ORDER BY sorts the query results in ascending or descending order.

Leave a Reply

Your email address will not be published. Required fields are marked *