Database MCQs (01-100)
1. A database is a:
A) Collection of programs
B) Collection of data
C) Collection of interrelated data and programs
D) None of these
Answer: C
Explanation: A database stores interrelated data managed by software (DBMS).
2. DBMS stands for:
A) Database Management System
B) Data Backup Management Software
C) Database Maintenance System
D) Data Base Manipulation Software
Answer: A
3. Which of the following is not a DBMS?
A) MySQL
B) Oracle
C) MS Access
D) MS Excel
Answer: D
Explanation: Excel is a spreadsheet, not a DBMS.
4. The language used to create and modify database schema is:
A) DML
B) DDL
C) DCL
D) TCL
Answer: B
Explanation: DDL (Data Definition Language) defines database structure.
5. Which command is used to remove a table from a database?
A) DELETE
B) DROP
C) REMOVE
D) TRUNCATE
Answer: B
6. In SQL, the SELECT statement is used to:
A) Insert data
B) Retrieve data
C) Delete data
D) Update data
Answer: B
7. Which of these is a valid SQL constraint?
A) PRIMARY KEY
B) UNIQUE
C) NOT NULL
D) All of the above
Answer: D
8. What does ACID stand for in databases?
A) Atomicity, Consistency, Isolation, Durability
B) Access, Control, Isolation, Durability
C) Automatic, Consistent, Indexed, Durable
D) None of these
Answer: A
9. Which key uniquely identifies each record in a table?
A) Foreign Key
B) Candidate Key
C) Primary Key
D) Alternate Key
Answer: C
10. A table can have:
A) Only one primary key
B) Multiple primary keys
C) No primary key
D) Two primary keys with the same name
Answer: A
11. Foreign key is used to:
A) Link two tables
B) Delete a table
C) Modify a column
D) Create a schema
Answer: A
12. Normalization is used to:
A) Reduce redundancy
B) Increase redundancy
C) Add more tables
D) None of these
Answer: A
13. The first normal form (1NF) removes:
A) Partial dependency
B) Repeating groups
C) Transitive dependency
D) None of these
Answer: B
14. Second Normal Form (2NF) removes:
A) Repeating groups
B) Partial dependency
C) Transitive dependency
D) None of these
Answer: B
15. Third Normal Form (3NF) removes:
A) Transitive dependency
B) Partial dependency
C) Multivalued dependency
D) None of these
Answer: A
16. SQL stands for:
A) Structured Query Language
B) Sequential Query Language
C) Simple Query Language
D) Standardized Query Language
Answer: A
17. Which of the following is a DML command?
A) SELECT
B) INSERT
C) UPDATE
D) All of these
Answer: D
18. The command to change a table structure is:
A) ALTER
B) UPDATE
C) MODIFY
D) CHANGE
Answer: A
19. What does the TRUNCATE command do?
A) Deletes all rows but keeps the structure
B) Deletes the table
C) Removes specific rows
D) Removes columns
Answer: A
20. Which SQL clause is used to filter records?
A) WHERE
B) GROUP BY
C) HAVING
D) ORDER BY
Answer: A
21. Which clause is used to sort results in SQL?
A) ORDER BY
B) GROUP BY
C) SORT BY
D) ARRANGE BY
Answer: A
22. The default sorting order in SQL is:
A) Descending
B) Ascending
C) Random
D) None
Answer: B
23. Which command is used to remove duplicate rows in SQL output?
A) UNIQUE
B) DISTINCT
C) DELETE
D) DIFFERENT
Answer: B
24. The aggregate function in SQL includes:
A) SUM
B) AVG
C) COUNT
D) All of these
Answer: D
25. What is a tuple in a database?
A) A column
B) A row
C) A field
D) A constraint
Answer: B
26. What is a schema?
A) Database design
B) Table data
C) Query
D) Report
Answer: A
27. Which level of data abstraction describes how data is stored?
A) Physical level
B) Logical level
C) View level
D) All levels
Answer: A
28. Which SQL keyword is used to combine records from two tables?
A) JOIN
B) UNION
C) COMBINE
D) CONNECT
Answer: A
29. INNER JOIN returns:
A) Only matching rows
B) All rows from both tables
C) Rows with NULL values
D) None of these
Answer: A
30. LEFT JOIN returns:
A) All rows from the left table and matched from the right
B) Only matching rows
C) All rows from the right
D) None
Answer: A
31. What does the GROUP BY clause do?
A) Groups rows with the same values
B) Sorts data
C) Filters records
D) Joins tables
Answer: A
32. Which key can be duplicated in a table?
A) Primary Key
B) Foreign Key
C) Unique Key
D) None
Answer: B
33. Which SQL command creates a new database?
A) NEW DATABASE
B) CREATE DATABASE
C) MAKE DATABASE
D) ADD DATABASE
Answer: B
34. What is a view in SQL?
A) Virtual table
B) Physical table
C) Index
D) None
Answer: A
35. Which of the following is not a type of database model?
A) Hierarchical
B) Relational
C) Object-oriented
D) Linear
Answer: D
36. The relational model was proposed by:
A) Edgar F. Codd
B) Charles Babbage
C) Bill Gates
D) James Gosling
Answer: A
37. Which of these is a transaction property?
A) Atomicity
B) Durability
C) Isolation
D) All of these
Answer: D
38. A deadlock occurs when:
A) Two transactions wait for each other
B) System crash
C) Database is full
D) None
Answer: A
39. Which of these prevents dirty reads?
A) Read committed
B) Read uncommitted
C) Serializable
D) Snapshot isolation
Answer: A
40. Indexing improves:
A) Query speed
B) Data accuracy
C) Data redundancy
D) None
Answer: A
41. Which SQL function returns the current date?
A) CURRENT_DATE
B) NOW()
C) GETDATE()
D) All of these (depending on DBMS)
Answer: D
42. Which command is used to rename a table?
A) RENAME
B) ALTER TABLE … RENAME TO
C) CHANGE NAME
D) MODIFY NAME
Answer: B
43. Which of these is not an aggregate function?
A) MAX
B) COUNT
C) LENGTH
D) SUM
Answer: C
44. What is the default isolation level in most DBMS?
A) Read Committed
B) Serializable
C) Read Uncommitted
D) Repeatable Read
Answer: A
45. A trigger is:
A) A stored procedure that executes automatically
B) A manual function
C) A constraint
D) A backup
Answer: A
46. Which statement is used to update data in SQL?
A) MODIFY
B) UPDATE
C) CHANGE
D) ALTER
Answer: B
47. The entity-relationship model uses:
A) Rectangles for entities
B) Diamonds for relationships
C) Ovals for attributes
D) All of these
Answer: D
48. Which key is a field that can uniquely identify a record but is not chosen as the primary key?
A) Candidate Key
B) Alternate Key
C) Super Key
D) Foreign Key
Answer: B
49. In relational databases, data is stored in:
A) Tables
B) Arrays
C) Trees
D) Files
Answer: A
50. Which SQL statement is used to remove duplicate rows from a table permanently?
A) DELETE with DISTINCT
B) DELETE + GROUP BY
C) CREATE new table with DISTINCT and drop old
D) None directly
Answer: C
51. Which of the following is a valid SQL subquery type?
A) Single-row subquery
B) Multiple-row subquery
C) Correlated subquery
D) All of these
Answer: D
52. A correlated subquery executes:
A) Once for the whole query
B) Once for each row returned by the main query
C) Before the main query
D) Randomly
Answer: B
53. Which clause restricts groups in SQL?
A) WHERE
B) HAVING
C) ORDER BY
D) LIMIT
Answer: B
54. Which operator checks for NULL values in SQL?
A) =
B) IS NULL
C) == NULL
D) EQUAL NULL
Answer: B
55. The SQL statement SELECT * FROM students WHERE marks BETWEEN 60 AND 80; retrieves:
A) Marks greater than 80
B) Marks between 60 and 80 (inclusive)
C) Marks below 60
D) None
Answer: B
56. Which function is used to find the number of rows in SQL?
A) SUM()
B) COUNT()
C) LENGTH()
D) TOTAL()
Answer: B
57. The UNION operator combines results of:
A) Two or more SELECT statements
B) One SELECT and one UPDATE
C) INSERT and DELETE
D) None
Answer: A
58. UNION removes duplicates unless:
A) UNION ALL is used
B) DISTINCT is added
C) GROUP BY is used
D) None
Answer: A
59. Which keyword is used to fetch the top N records in MySQL?
A) TOP
B) LIMIT
C) FIRST
D) FETCH
Answer: B
60. In SQL, NULL represents:
A) Zero
B) Empty string
C) Unknown or missing value
D) False
Answer: C
61. Which key is created automatically when a table is defined with a primary key?
A) Index key
B) Foreign key
C) Constraint key
D) None
Answer: A
62. Which index type stores data in a sorted order?
A) Clustered index
B) Non-clustered index
C) Bitmap index
D) None
Answer: A
63. A database trigger can be fired:
A) Before an action
B) After an action
C) Both A and B
D) None
Answer: C
64. Which of the following is true about stored procedures?
A) They are precompiled
B) They can accept parameters
C) They improve performance
D) All of the above
Answer: D
65. A cursor in SQL is used for:
A) Row-by-row processing
B) Bulk updates
C) Indexing
D) None
Answer: A
66. Which command revokes privileges from a user?
A) REVOKE
B) REMOVE
C) DELETE
D) DENY
Answer: A
67. Which command grants access rights in SQL?
A) GRANT
B) ALLOW
C) PERMIT
D) ENABLE
Answer: A
68. Data redundancy means:
A) Duplicate data stored in multiple places
B) No data stored
C) Data loss
D) None
Answer: A
69. What is a super key?
A) A key that uniquely identifies a record
B) A subset of candidate keys
C) A non-unique attribute
D) A foreign key
Answer: A
70. Candidate key is:
A) A super key with no redundant attributes
B) A duplicate key
C) Always composite
D) None
Answer: A
71. Referential integrity ensures:
A) Valid foreign key values
B) Unique primary key values
C) Data normalization
D) None
Answer: A
72. A composite key is made up of:
A) Two or more attributes
B) One attribute
C) Only numeric values
D) None
Answer: A
73. Which normal form eliminates multivalued dependency?
A) 4NF
B) 3NF
C) BCNF
D) 2NF
Answer: A
74. BCNF is stronger than:
A) 3NF
B) 2NF
C) 1NF
D) None
Answer: A
75. Which is not a valid type of join?
A) INNER JOIN
B) OUTER JOIN
C) CROSS JOIN
D) SIDE JOIN
Answer: D
76. Cartesian product occurs when:
A) No join condition is given
B) Table is empty
C) Duplicate rows exist
D) None
Answer: A
77. In an ER diagram, a weak entity is represented by:
A) Double rectangle
B) Rectangle
C) Diamond
D) Circle
Answer: A
78. Total participation is represented in ER diagram by:
A) Double line
B) Single line
C) Dashed line
D) None
Answer: A
79. The degree of a relationship in ER model refers to:
A) Number of entities involved
B) Number of attributes
C) Number of tuples
D) None
Answer: A
80. The attribute that identifies entity instances uniquely is called:
A) Key attribute
B) Derived attribute
C) Multivalued attribute
D) None
Answer: A
81. Derived attributes are represented by:
A) Dashed oval
B) Double oval
C) Rectangle
D) Diamond
Answer: A
82. Multivalued attributes are represented by:
A) Double oval
B) Dashed oval
C) Rectangle
D) Diamond
Answer: A
83. Which of the following is an example of a one-to-many relationship?
A) Teacher–Students
B) Student–Roll number
C) Country–Capital
D) Husband–Wife
Answer: A
84. Which of these is a one-to-one relationship?
A) Country–Capital
B) Author–Books
C) Class–Students
D) Department–Employees
Answer: A
85. Deadlock prevention can be achieved using:
A) Timestamp ordering
B) Wait-die scheme
C) Preemptive rollback
D) All of these
Answer: D
86. Which of these is a non-relational database?
A) MongoDB
B) Oracle
C) MySQL
D) PostgreSQL
Answer: A
87. NoSQL databases are best suited for:
A) Unstructured data
B) Structured data
C) Tabular data only
D) None
Answer: A
88. Which of the following is a key-value NoSQL database?
A) Redis
B) Cassandra
C) MongoDB
D) Neo4j
Answer: A
89. Which of the following is a document-oriented database?
A) MongoDB
B) Redis
C) Neo4j
D) DynamoDB
Answer: A
90. Which type of NoSQL database stores data as graphs?
A) Neo4j
B) MongoDB
C) Cassandra
D) Redis
Answer: A
91. Which command removes all records from a table without deleting the structure?
A) TRUNCATE
B) DROP
C) DELETE
D) REMOVE
Answer: A
92. Which SQL keyword is used to check existence of rows?
A) EXISTS
B) IN
C) ANY
D) ALL
Answer: A
93. The IN operator is used to:
A) Match multiple values in a list
B) Compare ranges
C) Filter NULLs
D) None
Answer: A
94. Which command is used to back up a database in SQL?
A) BACKUP DATABASE
B) COPY DATABASE
C) SAVE DATABASE
D) None
Answer: A
95. Which transaction state means the transaction is waiting to acquire a lock?
A) Active
B) Partially committed
C) Blocked
D) Aborted
Answer: C
96. The commit command is used to:
A) Save changes permanently
B) Undo changes
C) Lock table
D) Exit SQL
Answer: A
97. Rollback is used to:
A) Undo uncommitted changes
B) Save changes
C) Create logs
D) Restart system
Answer: A
98. Which of the following is a database storage structure?
A) File
B) Page
C) Block
D) All of these
Answer: D
99. Which of the following ensures consistency after system failure?
A) Recovery system
B) Buffer manager
C) Lock manager
D) Query processor
Answer: A
100. Which is the lowest level of data abstraction?
A) Physical level
B) Logical level
C) View level
D) None
Answer: A