Database Management System MCQs with Answers
Practice important Database Management System MCQs with answers and explanations.
Chapter: 30
Q501:
In SQL, aggregate functions operate on how many rows?
A. A single row
B. A set of rows
C. One column only
D. Multiple columns
Correct Answer:
B
Chapter: 30
Q502:
Cartesian joins are created by joining how many rows from two tables?
A. One row from each
B. All rows from one to all rows of the other
C. Only unique rows
D. None
Correct Answer:
B
Chapter: 30
Q503:
What does the HAVING clause do in SQL?
A. Filters records in grouped results
B. Filters individual records
C. Orders the results
D. Calculates aggregate values
Correct Answer:
A
Chapter: 30
Q504:
Which function in SQL returns the maximum value in a column?
A. MAX
B. MIN
C. SUM
D. COUNT
Correct Answer:
A
Chapter: 30
Q505:
Which type of SQL function is COUNT(*)?
A. Aggregate
B. String
C. Mathematical
D. Date
Correct Answer:
A
Chapter: 30
Q506:
Which function can you use to sum the values in a column in SQL?
A. SUM
B. MAX
C. AVG
D. COUNT
Correct Answer:
A
Chapter: 30
Q507:
Which SQL statement is used to group rows based on department and count the employees with a salary over Rs. 25,000?
A. SELECT department, COUNT(*), WHERE salary > 25000 GROUP BY department
B. SELECT COUNT(*), WHERE salary > 25000
C. SELECT COUNT(*), GROUP BY department
D. SELECT COUNT(*), FROM department
Correct Answer:
A
Chapter: 30
Q508:
Which join returns all the attributes of one table with all the attributes of another, resulting in m x n rows?
A. Inner join
B. Outer join
C. Cartesian join
D. Semi join
Correct Answer:
C
Chapter: 30
Q509:
In SQL, which function converts data from one type to another?
A. CONVERT
B. AVG
C. MIN
D. LENGTH
Correct Answer:
A
Chapter: 30
Q510:
Which of the following statements is TRUE about SQL aggregate functions?
A. Aggregate functions return multiple values
B. Aggregate functions operate on a set of rows
C. Aggregate functions return all columns
D. Aggregate functions are only used with INSERT statements
Correct Answer:
B
Chapter: 31
Q511:
What is the most commonly used form of merging two tables in a database?
A. Cartesian product
B. Join
C. Self join
D. Subquery
Correct Answer:
B
Chapter: 31
Q512:
In an Inner Join, rows from two tables are joined based on:
A. The same primary key
B. The same table
C. A common attribute with the same value
D. Different data types
Correct Answer:
C
Chapter: 31
Q513:
In SQL, which command is used to grant privileges to users?
A. GRANT
B. REVOKE
C. INSERT
D. SELECT
Correct Answer:
A
Chapter: 31
Q514:
In a Right Outer Join, rows from which table appear in the result even if there is no match?
A. The left table
B. The right table
C. Both tables
D. None
Correct Answer:
B
Chapter: 31
Q515:
The common attribute in Inner Join must have the same _______ in both tables.
A. Name
B. Domain
C. Size
D. Primary Key
Correct Answer:
B
Chapter: 31
Q516:
A semi join allows you to:
A. Know the matching rows of both tables
B. Know the rows of one table involved
C. Know the PK of both tables
D. Perform outer join
Correct Answer:
B
Chapter: 31
Q517:
In a Full Outer Join, rows without a match from both tables ______.
A. Appear once
B. Are discarded
C. Are repeated
D. Are excluded
Correct Answer:
A
Chapter: 31
Q518:
In a self join, a table is joined with _______.
A. Another table
B. Itself
C. The parent table
D. A child table
Correct Answer:
B
Chapter: 31
Q519:
Which command is used to withdraw privileges from a user in SQL?
A. SELECT
B. REVOKE
C. GRANT
D. DELETE
Correct Answer:
B
Chapter: 31
Q520:
What SQL command would you use to display all records where the cgpa is higher than the highest cgpa in the BCS program?
A. SELECT * FROM student WHERE cgpa >
B. SELECT MAX(cgpa) FROM student
C. SELECT * FROM student WHERE prName =
D. SELECT * FROM program WHERE cgpa =
Correct Answer:
A