Skip to main content

Database Modeling and Design MCQs with Answers

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

Chapter: 18
Q261:
Which SQL clause is used to sort the result set?
A. ORDER BY
B. WHERE
C. GROUP BY
D. HAVING
Correct Answer: A
Chapter: 18
Q262:
What does the LIKE operator do in SQL?
A. Searches for a specified pattern in a column
B. Filters records based on exact match
C. Returns unique values from a column
D. Orders the result set
Correct Answer: A
Chapter: 18
Q263:
What is the purpose of the IN operator in SQL?
A. Searches for values from a given list
B. Filters records based on a condition
C. Groups rows together
D. Returns the average of a column
Correct Answer: A
Chapter: 18
Q264:
How do you find employees with 'E' in their name or names ending with 'G'?
A. SELECT * FROM emp WHERE ename LIKE '%E%' OR ename LIKE '%-G'
B. SELECT * FROM emp WHERE ename LIKE '%E%' AND ename LIKE '%-G'
C. SELECT * FROM emp WHERE ename LIKE '%E%' OR ename LIKE '%G'
D. SELECT * FROM emp WHERE ename LIKE '%E%' OR ename LIKE '%G%'
Correct Answer: A
Chapter: 18
Q265:
What does the ROUND() function do in SQL?
A. Rounds a numeric value to a specified number of decimal places
B. Returns the number of rows in a table
C. Returns the length of a string
D. Returns the maximum value in a column
Correct Answer: A
Chapter: 19
Q266:
What does a Cartesian product involve in SQL?
A. Joining every row of the first table with every row of the second table
B. Filtering rows based on conditions
C. Combining rows from multiple tables with matching keys
D. None of the above
Correct Answer: A
Chapter: 19
Q267:
In a Cartesian product of two sets with 3 and 2 elements respectively, what is the total number of pairs?
A. 3
B. 6
C. 9
D. 12
Correct Answer: B
Chapter: 19
Q268:
What is the main problem with Cartesian product in relational databases?
A. Data duplication and loss of data integrity
B. Incorrect join conditions
C. Unmatched rows in the result set
D. Slow query performance
Correct Answer: A
Chapter: 19
Q269:
Which SQL join operation combines rows based on a common key in both tables?
A. Cartesian Join
B. Inner Join
C. Outer Join
D. Self Join
Correct Answer: B
Chapter: 19
Q270:
How do you write a basic Inner Join query in SQL?
A. SELECT * FROM table1, table2 WHERE table1.key = table2.key
B. SELECT * FROM table1, table2
C. SELECT * FROM table1 JOIN table2 ON table1.key = table2.key
D. SELECT * FROM table1 LEFT JOIN table2 ON table1.key = table2.key
Correct Answer: A
Chapter: 19
Q271:
What does a Self-Join allow you to do?
A. Join a table with itself to compare values
B. Join two different tables based on a common key
C. Join tables and include all rows regardless of matching keys
D. None of the above
Correct Answer: A
Chapter: 19
Q272:
Which SQL statement represents a Self-Join on the Customer table?
A. SELECT a.ID, b.NAME FROM CUSTOMER a, CUSTOMER b WHERE a.SALARY < b.SALARY
B. SELECT a.ID, b.NAME FROM CUSTOMER a, CUSTOMER b WHERE a.ID = b.ID
C. SELECT a.ID, b.SALARY FROM CUSTOMER a, CUSTOMER b WHERE a.NAME = b.NAME
D. SELECT a.ID, b.AGE FROM CUSTOMER a, CUSTOMER b WHERE a.SALARY = b.SALARY
Correct Answer: A
Chapter: 19
Q273:
An Outer Join in SQL ensures that:
A. Only matching rows are returned
B. All rows from both tables are returned, including non-matching rows
C. Only rows with NULL values are returned
D. Only rows with matching keys are returned
Correct Answer: B
Chapter: 19
Q274:
In a Left Outer Join, which rows are included in the result?
A. All rows from the right table, even if there is no match
B. All rows from the left table, including those with no match in the right table
C. Only rows with matching keys in both tables
D. Only rows from the right table with non-NULL values
Correct Answer: B
Chapter: 19
Q275:
What is the primary difference between Left Outer Join and Right Outer Join?
A. The table from which all rows are included is different in each join
B. The type of rows returned is different
C. The join condition is different
D. The result set is different
Correct Answer: A
Chapter: 19
Q276:
When using a Right Outer Join, what happens if there are no matching rows in the left table?
A. NULL values appear for the columns from the left table
B. All rows from the left table are included
C. Only matching rows are included
D. No rows are returned
Correct Answer: A
Chapter: 19
Q277:
What is the purpose of a subquery in SQL?
A. To join tables based on a common key
B. To select data rows for criteria developed during query execution
C. To combine rows from multiple tables with matching keys
D. To filter rows based on specific conditions
Correct Answer: B
Chapter: 19
Q278:
How is a subquery typically used in a SQL statement?
A. In the FROM clause
B. As part of the JOIN operation
C. In the WHERE clause
D. As part of the SELECT clause
Correct Answer: C
Chapter: 19
Q279:
The Cartesian Product of two sets, A and B, where A has 4 elements and B has 5 elements, will have how many pairs?
A. 9
B. 20
C. 15
D. 25
Correct Answer: B
Chapter: 19
Q280:
Which join operation is used when you need to include all rows from one table and matching rows from another table, even if some rows in the second table do not match?
A. Inner Join
B. Outer Join
C. Self Join
D. Cross Join
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Database Modeling and Design

🚀 Start Quiz Now