Database Modeling and Design MCQs with Answers
Practice important Database Modeling and Design MCQs with answers and explanations.
Multiple Choice Questions
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
View Answer
A
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
View Answer
A
Q253: Which operator is used to search for a specified pattern in a column?
- A: LIKE
- B: IN
- C: BETWEEN
- D: NOT
View Answer
A
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
View Answer
A
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
View Answer
A
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
View Answer
A
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
View Answer
A
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
View Answer
A
Q259: Which SQL function calculates the average salary?
- A: AVG()
- B: MAX()
- C: MIN()
- D: SUM()
View Answer
A
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
View Answer
A