0Pricing
SQL Interview Prep · Lesson

What Is SQL and Why Interviewers Ask It

Define SQL, DDL vs DML vs DCL vs TCL, and the difference between SQL and a relational database engine.

What Is SQL and Why Interviewers Ask It is a free SQL Interview Prep lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the SQL Interview Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why This Question Opens Interviews

Almost every SQL interview opens with "What is SQL?" It's a filter: a strong answer names what SQL is, what it works on, and its statement types. Let's build yours.

What SQL Actually Is

SQL is a declarative language for relational databases: you describe the result you want, and the engine figures out how. It works on tables of rows and columns.

SELECT name, salary
FROM employees
WHERE department = 'Engineering';

SQL Is Not the Database Engine

A common trap: SQL is the language; MySQL, Postgres, and Oracle are the engines that implement it. Each adds its own dialect on top of the standard.

The Four Statement Categories

Interviewers love asking you to categorize SQL statements. There are four groups: DDL for structure, DML for data, DCL for permissions, and TCL for transactions.

DDL: Defining Structure

DDL shapes your database: CREATE, ALTER, DROP, TRUNCATE. A nuance to mention: most DDL auto-commits, so it usually can't be rolled back.

CREATE TABLE employees (
  id INTEGER PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  department VARCHAR(50),
  salary NUMERIC(10,2)
);

DML: Manipulating Data

DML changes the rows inside tables: INSERT, UPDATE, DELETE, and SELECT. Safe answer: "SELECT is read-only DML, sometimes split out as DQL."

UPDATE employees
SET salary = salary * 1.10
WHERE department = 'Engineering';

DCL: Controlling Access

DCL controls who can do what, with just two commands: GRANT gives a privilege and REVOKE takes it away. It shows you know a database is multi-user.

GRANT SELECT, INSERT ON employees TO analyst_role;
REVOKE INSERT ON employees FROM analyst_role;

TCL: Controlling Transactions

TCL groups changes into all-or-nothing transactions: BEGIN, COMMIT, ROLLBACK, SAVEPOINT. The key word is atomicity: all of it happens, or none does.

BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;

Declarative vs Procedural

Why is SQL declarative? You state the result you want and let the query optimizer pick how to get it. It's also set-based: it works on whole sets of rows at once.

Worked Example: Categorizing Statements

Interviewers often hand you statements to label. The code below shows the four categories in action, plus the classic trap: TRUNCATE removes data but counts as DDL.

Putting It Into a 30-Second Answer

Have a crisp 30-second answer ready to deliver under pressure. The boxed definition below covers the opening question and several likely follow-ups in one breath.

Quick Check

Test your grasp of the statement categories.

Recap

Recap: SQL is a declarative, set-based language for relational data. It splits into DDL, DML, DCL, TCL. Watch the traps: TRUNCATE is DDL, SELECT is read-only DML.

Frequently asked questions

Is the “What Is SQL and Why Interviewers Ask It” lesson free?

Yes — the full text of “What Is SQL and Why Interviewers Ask It” is free to read here on the web, and the SQL Interview Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the SQL Interview Prep course, upgrade to CoddyKit PRO.

What will I learn in “What Is SQL and Why Interviewers Ask It”?

Define SQL, DDL vs DML vs DCL vs TCL, and the difference between SQL and a relational database engine. You practise SQL Interview Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start SQL Interview Prep?

No prior experience is required. SQL Interview Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “What Is SQL and Why Interviewers Ask It” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this SQL Interview Prep lesson?

Yes. Every SQL Interview Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Is SQL and Why Interviewers Ask It
  2. Logical Query Execution Order
  3. Primary Keys, Foreign Keys and Constraints
  4. Reading a Schema Under Pressure
← Back to SQL Interview Prep