D
DevPrepSystematic Prep
SQL · EASY CODEX

SQL Interview Questions — Easy

Core concepts, definitions, basic syntax, and first principles expected in round 1 screening.

50 Theory Questions7 Implementation Folios5 Free Model Answers
THEORY QUESTIONS & SOLUTIONSShowing 5 of 50 questions
Q1What is SQL and how does it differ from NoSQL?
  • SQL (Structured Query Language): Relational database management system (RDBMS) language. Uses structured schemas, tabular relations (tables/columns/rows), and enforces ACID properties.
  • NoSQL (Not Only SQL): Non-relational database system. Uses flexible schemas (document, key-value, wide-column, graph), scales horizontally, and prioritizes BASE properties (Basically Available, Soft state, Eventual consistency).
Q2Categorize standard SQL commands into their sub-languages. What are DDL, DML, TCL, and DCL?
  • DDL (Data Definition Language): Defines/modifies schema structures. Commands: CREATE, ALTER, DROP, TRUNCATE.
  • DML (Data Manipulation Language): Manipulates and queries data. Commands: SELECT, INSERT, UPDATE, DELETE.
  • TCL (Transaction Control Language): Manages database transactions. Commands: COMMIT, ROLLBACK, SAVEPOINT.
  • DCL (Data Control Language): Manages access permissions. Commands: GRANT, REVOKE.
Q3What is a Primary Key and how does it differ from a Unique Key?
  • Primary Key (PK): Uniquely identifies a record in a table. Does not allow NULLs. Only one PK allowed per table. Creates a clustered index by default.
  • Unique Key (UK): Ensures all values in a column are distinct. Allows NULL values (single or multiple depending on SQL dialect). Multiple UKs allowed per table. Creates a non-clustered index by default.
Q4What is a Foreign Key, and how does it maintain referential integrity?
  • Foreign Key (FK): A column or group of columns in one table that references the PK/UK of another table.
  • Referential Integrity: Ensures relationships between tables remain consistent. Prevents orphaned rows by restricting invalid inserts, and handles deletes/updates via rules like ON DELETE CASCADE or ON DELETE SET NULL.
Q5What are the different types of Joins in SQL?
  • INNER JOIN: Returns records with matching values in both tables.
  • LEFT (OUTER) JOIN: Returns all records from the left table, and matching records from the right; unmatched right side returns NULL.
  • RIGHT (OUTER) JOIN: Returns all records from the right table, and matching records from the left; unmatched left side returns NULL.
  • FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table; unmatched rows return NULL.
  • CROSS JOIN: Returns the Cartesian product of both tables (every combination of rows).

Unlock the remaining 52 SQL (Easy) questions

You've completed the 5 free sample questions. Get unrestricted lifetime access to every question, model answer, implementation challenge, and all 27+ technologies for a single payment.

₹399 India / $9 International · One-time settlement · Zero subscription

CROSS-DIFFICULTY NAVIGATION

Continue Preparing SQL

SQL Interview Questions (Easy) | DevPrep | DevPrep