SQL MCQs | Database Interview MCQ Questions and Answers

Test your knowledge of Database - [ SQL ] section with these interactive multiple-choice questions.

« First 4 5 6 7 Last »
« Previous Page Next Page »

81. Which index type is optimized for text search?

  • a) Full-text index
  • b) B-tree index
  • c) Hash index
  • d) Bitmap index
Answer: A - Full-text indexes enable efficient word-based searches in large text fields.

82. What is query plan caching?

  • a) Storing execution plans for reuse
  • b) Backing up SQL statements
  • c) Encrypting queries
  • d) Compressing result sets
Answer: A - Cached plans reduce compilation overhead for repeated queries.

83. Which SQL feature encrypts data at rest?

  • a) Transparent Data Encryption (TDE)
  • b) SSL/TLS
  • c) Column-level encryption
  • d) Both A and C
Answer: D - TDE encrypts entire databases, while column-level encryption provides granular protection.

84. What is the purpose of the SQL CONTAINS() function?

  • a) Full-text search with advanced operators
  • b) Substring matching
  • c) NULL value detection
  • d) Data type validation
Answer: A - CONTAINS() supports proximity, inflectional, and weighted searches.

85. Which database role has unrestricted access?

  • a) sysadmin
  • b) db_owner
  • c) superuser
  • d) All of the above
Answer: D - Terminology varies by DBMS (SQL Server: sysadmin, PostgreSQL: superuser).

86. What is a covering index?

  • a) Index that includes all queried columns
  • b) Index spanning multiple tables
  • c) Encrypted index
  • d) Temporary query index
Answer: A - Covering indexes eliminate table access by storing extra columns.

87. Which SQL function calculates spatial distance?

  • a) ST_Distance()
  • b) GEO_DISTANCE()
  • c) SPATIAL_LENGTH()
  • d) MAP_DISTANCE()
Answer: A - ST_Distance() measures between geometry/geography objects.

88. What is parameter sniffing in SQL?

  • a) Using parameter values to optimize plans
  • b) Detecting SQL injection
  • c) Validating input formats
  • d) Encrypting query parameters
Answer: A - Parameter sniffing can cause plan reuse issues with skewed data distributions.

89. Which isolation level allows dirty reads?

  • a) READ UNCOMMITTED
  • b) READ COMMITTED
  • c) REPEATABLE READ
  • d) SERIALIZABLE
Answer: A - READ UNCOMMITTED sees uncommitted changes from other transactions.

90. What is the purpose of the SQL FREETEXT() function?

  • a) Natural language text search
  • b) Exact phrase matching
  • c) Regular expression search
  • d) Data compression
Answer: A - FREETEXT() matches meaning rather than exact wording.

91. Which index type is best for low-cardinality columns?

  • a) Bitmap index
  • b) B-tree index
  • c) Hash index
  • d) Full-text index
Answer: A - Bitmap indexes efficiently represent few distinct values (e.g., gender flags).

92. What is the purpose of the SQL ST_Within() function?

  • a) Tests if geometry is inside another
  • b) Calculates area
  • c) Measures perimeter
  • d) Generates buffers
Answer: A - ST_Within(geom1, geom2) checks spatial containment.

93. Which statement creates a role?

  • a) CREATE ROLE
  • b) MAKE ROLE
  • c) ADD ROLE
  • d) DEFINE ROLE
Answer: A - Roles simplify permission management by grouping users.

94. What is index fragmentation?

  • a) Disordered pages reducing efficiency
  • b) Broken index links
  • c) Encrypted index corruption
  • d) Partition misalignment
Answer: A - Fragmentation occurs from heavy DML operations (REBUILD/REORGANIZE fixes it).

95. Which SQL feature tracks data changes over time?

  • a) Change Data Capture (CDC)
  • b) Temporal tables
  • c) Transaction logs
  • d) All of the above
Answer: D - All methods capture history (CDC streams changes, temporal tables auto-version).

96. What is the purpose of the SQL SOUNDEX() function?

  • a) Phonetic similarity matching
  • b) Audio data storage
  • c) Volume calculation
  • d) Encryption
Answer: A - SOUNDEX() finds names sounding similar (e.g., "Smith" and "Smyth").

97. Which constraint ensures values exist in another table?

  • a) FOREIGN KEY
  • b) CHECK
  • c) EXISTS
  • d) VALIDATE
Answer: A - Foreign keys enforce referential integrity between tables.

98. What is a clustered index?

  • a) Index that physically orders table data
  • b) Composite index
  • c) Full-text index
  • d) Temporary index
Answer: A - Each table can have only one clustered index (usually PRIMARY KEY).

99. Which SQL function generates UUIDs?

  • a) NEWID() / UUID()
  • b) GENERATE_ID()
  • c) UNIQUE_ID()
  • d) RANDOM_ID()
Answer: A - Syntax varies (SQL Server: NEWID(), MySQL: UUID()).

100. What is the purpose of the SQL ST_Buffer() function?

  • a) Creates a polygon around a geometry
  • b) Compresses spatial data
  • c) Measures density
  • d) Encrypts coordinates
Answer: A - ST_Buffer(geom, distance) generates proximity zones.
« First 4 5 6 7 Last »
« Previous Page Next Page »

SQL MCQs - Master Database Concepts from Basic to Advanced | PCBooks

🚀 Want to master SQL for interviews and exams? PCBooks offers the most comprehensive free SQL MCQ bank covering queries, joins, subqueries, and database optimization. Perfect for:

📊 SQL Query & Database Design MCQs

👉 SELECT, INSERT, UPDATE, DELETE command practice
👉 INNER, LEFT, RIGHT, FULL JOINs with real-world scenarios
👉 GROUP BY, HAVING, ORDER BY advanced usage
👉 Indexing strategies and query optimization techniques

📚 Free SQL Learning Path

🎯 Step-by-step tutorials on:
- Database normalization (1NF to BCNF)
- Stored procedures and functions
- Window functions (ROW_NUMBER, RANK, DENSE_RANK)
- Transaction control (COMMIT, ROLLBACK, SAVEPOINT)
🎯 Chapter-wise quizzes with detailed explanations
🎯 Downloadable SQL cheat sheets for quick revision

🚀 Practice SQL MCQs Now

Start Basic SQL MCQs →
MongoDB MCQs Practice →
Top 300 DBMS Concepts Interview Questions →


🏆 Trusted by 75,000+ learners for SQL certification and career growth!