SQL MCQs | Database Interview MCQ Questions and Answers

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

« First 8 9 10 11 Last »
« Previous Page Next Page »

161. Which SQL feature enforces row-level security?

  • a) Row-Level Security (RLS)
  • b) Column Masking
  • c) Dynamic Data Masking
  • d) All of the above
Answer: A - RLS filters rows based on user context/policies (CREATE SECURITY POLICY).

162. What is data virtualization in SQL?

  • a) Querying distributed data as single source
  • b) Encrypting virtual tables
  • c) Creating temporary databases
  • d) Replicating data in memory
Answer: A - Tools like PolyBase and Oracle Database Links enable federated queries.

163. Which statement integrates blockchain hashes?

  • a) ADD BLOCKCHAIN HASH
  • b) CREATE LEDGER TABLE
  • c) ENABLE IMMUTABLE LOG
  • d) GENERATE CRYPTO LINK
Answer: B - SQL Server 2022+ ledger tables use SHA-256 hashing for tamper evidence.

164. What is an edge database?

  • a) Decentralized database near data sources
  • b) Encrypted database
  • c) Graph database
  • d) Time-series database
Answer: A - Runs on IoT devices/edge servers (SQLite, EdgeDB).

165. Which SQL feature enables augmented analytics?

  • a) Built-in machine learning
  • b) Natural language processing
  • c) Automated insights
  • d) All of the above
Answer: D - Modern DBMS integrate AI for pattern detection and NLQ.

166. What is the purpose of the SQL ENCRYPTBYKEY() function?

  • a) Encrypts data using symmetric keys
  • b) Generates digital signatures
  • c) Hashes passwords
  • d) Creates certificates
Answer: A - Part of SQL Server's Always Encrypted feature.

167. Which database provides built-in geospatial AI?

  • a) Oracle Spatial
  • b) PostGIS
  • c) SQL Server with ML Services
  • d) All of the above
Answer: D - Offer spatial clustering, routing, and pattern detection.

168. What is the purpose of the SQL GENERATE_SERIES() function?

  • a) Creates number/date sequences
  • b) Generates test data
  • c) Outputs result sets
  • d) Replicates rows
Answer: A - PostgreSQL/SQL Server 2022+ function for gap filling.

169. Which statement creates a dynamic data mask?

  • a) ALTER TABLE...ADD MASKED WITH
  • b) CREATE DATA MASK
  • c) ENABLE COLUMN MASKING
  • d) DEFINE SENSITIVE FIELD
Answer: A - Hides sensitive data from unauthorized users (e.g., email masking: xxx@xxx.com).

170. What is the purpose of the SQL HASHBYTES() function?

  • a) Computes cryptographic hashes
  • b) Encrypts data
  • c) Compresses values
  • d) Validates checksums
Answer: A - Supports algorithms like SHA2_256 (SQL Server).

171. Which database feature enables zero-copy cloning?

  • a) Snowflake Time Travel
  • b) Oracle Flashback Database
  • c) SQL Server Database Snapshots
  • d) All of the above
Answer: D - Creates instant copies without storage duplication.

172. What is the purpose of the SQL DECRYPTBYKEY() function?

  • a) Decrypts data encrypted with symmetric keys
  • b) Validates digital signatures
  • c) Tests password strength
  • d) Extracts certificate data
Answer: A - Requires proper key permissions in SQL Server.

173. Which SQL feature detects anomalous queries?

  • a) Threat Detection
  • b) Anomaly Alerting
  • c) Query Risk Assessment
  • d) All of the above
Answer: D - Cloud databases monitor for SQL injection/data exfiltration patterns.

174. What is the purpose of the SQL IS_JSON() function?

  • a) Validates JSON syntax
  • b) Extracts JSON values
  • c) Converts data to JSON
  • d) Compresses JSON
Answer: A - Returns 1/0 for valid JSON (SQL Server/Oracle).

175. Which database provides built-in graph pattern matching?

  • a) Neo4j (Cypher)
  • b) Oracle PGQL
  • c) SQL Server MATCH clause
  • d) All of the above
Answer: D - Specialized syntax for path traversals.

176. What is the purpose of the SQL COMPRESS() function?

  • a) Reduces data size using algorithms
  • b) Minifies SQL queries
  • c) Compacts indexes
  • d) Shrinks databases
Answer: A - Uses GZIP/ZLIB in SQL Server/PostgreSQL.

177. Which statement creates a temporal history table?

  • a) CREATE TABLE...WITH SYSTEM_VERSIONING
  • b) MAKE HISTORY TABLE
  • c) ENABLE TEMPORAL TRACKING
  • d) DEFINE VERSION STORE
Answer: A - Automatically maintains row versions in a separate table.

178. What is the purpose of the SQL DECOMPRESS() function?

  • a) Reverses COMPRESS() operations
  • b) Extracts archive files
  • c) Unpacks columnstore indexes
  • d) Expands encrypted data
Answer: A - Restores original data from compressed binary.

179. Which database feature enables natural language queries?

  • a) Power BI Q&A
  • b) Oracle Language Service
  • c) Google Cloud NL-to-SQL
  • d) All of the above
Answer: D - Converts "Show me top customers by sales" to SQL.

180. What is the purpose of the SQL SESSION_USER function?

  • a) Returns current session username
  • b) Creates temporary users
  • c) Validates credentials
  • d) Tracks logins
Answer: A - Useful for auditing and row-level security contexts.
« First 8 9 10 11 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!