Skip to main content

Database Modeling and Design MCQs with Answers

Practice important Database Modeling and Design MCQs with answers and explanations.

Chapter: 17
Q241:
What does the DELETE statement do?
A. Deletes all rows from a table
B. Deletes a specific row or rows from a table
C. Updates data in a table
D. Adds new rows to a table
Correct Answer: B
Chapter: 17
Q242:
How can you delete all rows from a table?
A. TRUNCATE TABLE TableName;
B. UPDATE TableName SET column=value;
C. INSERT INTO TableName VALUES ();
D. DELETE FROM TableName;
Correct Answer: A
Chapter: 17
Q243:
What is the difference between DELETE and TRUNCATE?
A. DELETE can be faster than TRUNCATE
B. TRUNCATE removes rows and retains the table structure
C. DELETE removes rows and retains the table structure
D. TRUNCATE removes rows and does not allow rollback
Correct Answer: B
Chapter: 17
Q244:
What is a transaction in a database context?
A. A unit of work performed against a database
B. A method to update multiple columns
C. A way to add new data
D. A command to delete rows
Correct Answer: A
Chapter: 17
Q245:
What does the COMMIT statement do?
A. Undoes changes made to the database
B. Saves all changes made during a transaction
C. Deletes specific rows from the table
D. Updates a single column in the table
Correct Answer: B
Chapter: 17
Q246:
When is the ROLLBACK statement used?
A. To save changes made in a transaction
B. To undo changes made during a transaction
C. To create a new table
D. To modify existing data
Correct Answer: B
Chapter: 18
Q247:
What does SQL stand for?
A. Structured Query Language
B. Sequential Query Language
C. System Query Language
D. Structured Query Logic
Correct Answer: A
Chapter: 18
Q248:
Which SQL statement retrieves all columns from a table?
A. SELECT * FROM table_name
B. SELECT COLUMN FROM table_name
C. SELECT ALL FROM table_name
D. SELECT ALL COLUMNS FROM table_name
Correct Answer: A
Chapter: 18
Q249:
What does the DISTINCT keyword do in SQL?
A. Removes duplicate rows
B. Sorts the results
C. Filters rows based on a condition
D. Changes the data type of a column
Correct Answer: A
Chapter: 18
Q250:
Which SQL command is used to modify existing data in a table?
A. UPDATE
B. INSERT
C. SELECT
D. DELETE
Correct Answer: A
Chapter: 18
Q251:
How do you specify multiple conditions in a WHERE clause?
A. Using AND, NOT, and OR operators
B. Using DISTINCT
C. Using GROUP BY
D. Using ORDER BY
Correct Answer: A
Chapter: 18
Q252:
What is the function of the WHERE clause in SQL?
A. Filters rows based on a condition
B. Groups rows together
C. Sorts the rows
D. Calculates aggregate functions
Correct Answer: A
Chapter: 18
Q253:
Which operator is used to search for a specified pattern in a column?
A. LIKE
B. IN
C. BETWEEN
D. NOT
Correct Answer: A
Chapter: 18
Q254:
What does the BETWEEN operator do in SQL?
A. Selects values within a range
B. Searches for a specific pattern
C. Filters records based on exact match
D. Combines multiple conditions
Correct Answer: A
Chapter: 18
Q255:
How do you find all employees with salaries between 2500 and 5000?
A. SELECT * FROM emp WHERE sal BETWEEN 2500 AND 5000
B. SELECT * FROM emp WHERE sal > 2500 AND sal < 5000
C. SELECT * FROM emp WHERE sal >= 2500 AND sal <= 5000
D. SELECT * FROM emp WHERE sal = 2500 AND sal = 5000
Correct Answer: A
Chapter: 18
Q256:
What is the purpose of the GROUP BY clause?
A. Groups rows into summary rows based on columns
B. Sorts the results
C. Filters results based on a condition
D. Updates data in the table
Correct Answer: A
Chapter: 18
Q257:
What is the difference between the WHERE and HAVING clauses?
A. WHERE filters rows before grouping; HAVING filters groups after grouping
B. WHERE filters rows before grouping; HAVING filters rows before grouping
C. WHERE filters groups; HAVING filters rows
D. WHERE filters rows; HAVING filters columns
Correct Answer: A
Chapter: 18
Q258:
How do you display the maximum salary in each department?
A. SELECT MAX(sal), deptno FROM emp GROUP BY deptno
B. SELECT deptno, MAX(sal) FROM emp GROUP BY deptno
C. SELECT MAX(sal) FROM emp GROUP BY deptno
D. SELECT deptno, MAX(sal) FROM emp
Correct Answer: A
Chapter: 18
Q259:
Which SQL function calculates the average salary?
A. AVG()
B. MAX()
C. MIN()
D. SUM()
Correct Answer: A
Chapter: 18
Q260:
What does the SQL function LENGTH() do?
A. Returns the length of a string
B. Returns the number of rows in a table
C. Returns the sum of a numeric column
D. Returns the maximum value in a column
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Database Modeling and Design

🚀 Start Quiz Now