LearnThatStack Ace your next interview
Database Technologies
SQL Fundamentals.
41 Qs 6 free
Change topic Change
Drill · questions

All questions

of 41
Beginner 13
01

What is SQL and what are its main components?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • DDL (Data Definition Language): CREATE, ALTER, DROP, TRUNCATE - used to define database structure
  • DML (Data Manipulation Language): SELECT, INSERT, UPDATE, DELETE - used to manipulate data
  • DCL (Data Control Language): GRANT, REVOKE - used to control access permissions
  • TCL (Transaction Control Language): COMMIT, ROLLBACK, SAVEPOINT - used to manage transactions
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

The model's verdict: “

The interactive diagram is below the answer - jump to diagram ↓

This answer is explained by a shared concept diagram - open

Tailored explanation · switch back to · ·
Point the redraw:
How well did you know this?
AI:

02

What's the difference between DELETE, TRUNCATE, and DROP?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • DELETE: Removes specific rows based on WHERE condition. Can be rolled back, triggers fire, slower for large datasets.
  • TRUNCATE: Removes all rows from table but keeps structure. Faster than DELETE, cannot be rolled back in most databases, doesn't fire triggers.
  • DROP: Completely removes the table structure and data from database. Cannot be rolled back.
DELETE FROM employees WHERE age > 65;  -- Removes specific rows
TRUNCATE TABLE employees;              -- Removes all rows, keeps table
DROP TABLE employees;                  -- Removes entire table
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

The model's verdict: “

The interactive diagram is below the answer - jump to diagram ↓

This answer is explained by a shared concept diagram - open

Tailored explanation · switch back to · ·
Point the redraw:
How well did you know this?
AI:

03

What is a Primary Key and what are its characteristics?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • Uniqueness: No duplicate values allowed
  • Not NULL: Cannot contain NULL values
  • Immutable: Values should not change once assigned
  • One per table: Each table can have only one primary key
  • Automatic indexing: Database automatically creates an index on primary key
CREATE TABLE employees (
    emp_id INT PRIMARY KEY,
    name VARCHAR(100) NOT NULL
);
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

The model's verdict: “

The interactive diagram is below the answer - jump to diagram ↓

This answer is explained by a shared concept diagram - open

Tailored explanation · switch back to · ·
Point the redraw:
How well did you know this?
AI:

04

What's the difference between WHERE and HAVING clauses?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • WHERE: Filters rows before grouping, cannot use aggregate functions, applied to individual rows
  • HAVING: Filters groups after GROUP BY, can use aggregate functions, applied to grouped results
-- WHERE filters before grouping
SELECT department, COUNT(*) 
FROM employees 
WHERE salary > 50000 
GROUP BY department;
-- HAVING filters after grouping
SELECT department, COUNT(*) 
FROM employees 
GROUP BY department 
HAVING COUNT(*) > 5;
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

The model's verdict: “

The interactive diagram is below the answer - jump to diagram ↓

This answer is explained by a shared concept diagram - open

Tailored explanation · switch back to · ·
Point the redraw:
How well did you know this?
AI:

05

What's the difference between UNION and UNION ALL?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • UNION: Combines result sets and removes duplicate rows, slower due to duplicate elimination
  • UNION ALL: Combines result sets keeping all rows including duplicates, faster execution
    Both require same number of columns with compatible data types in the same order.
SELECT name FROM employees_2023
UNION                    -- Removes duplicates
SELECT name FROM employees_2024;
SELECT name FROM employees_2023
UNION ALL               -- Keeps all rows
SELECT name FROM employees_2024;
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

The model's verdict: “

The interactive diagram is below the answer - jump to diagram ↓

This answer is explained by a shared concept diagram - open

Tailored explanation · switch back to · ·
Point the redraw:
How well did you know this?
AI:

06

What are constraints and what types are available?

Beginner ·

Answer it yourself first - out loud, or typed below.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain
  • NOT NULL: Prevents null values
  • UNIQUE: Ensures uniqueness across rows
  • PRIMARY KEY: Combines NOT NULL and UNIQUE
  • FOREIGN KEY: Maintains referential integrity between tables
  • CHECK: Validates data against specified conditions
  • DEFAULT: Provides default values when none specified
CREATE TABLE orders (
    order_id INT PRIMARY KEY,
    customer_id INT NOT NULL,
    order_date DATE DEFAULT GETDATE(),
    total_amount DECIMAL(10,2) CHECK (total_amount > 0),
    FOREIGN KEY (customer_id) REFERENCES customers(id)
);
Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

The model's verdict: “

The interactive diagram is below the answer - jump to diagram ↓

This answer is explained by a shared concept diagram - open

Tailored explanation · switch back to · ·
Point the redraw:
How well did you know this?
AI:

07

How do you handle NULL values in SQL?

Part of Pro
08

What's the difference between a view and a table?

Part of Pro
09

What's the difference between CHAR and VARCHAR data types?

Part of Pro
10

What are the different types of database relationships?

Part of Pro
11

What are aggregate functions and how do they work with GROUP BY?

Part of Pro
12

How do you perform case-insensitive searches in SQL?

Part of Pro
13

What are database functions and what types exist?

Part of Pro
Intermediate 18
14

Explain the different types of SQL JOINs.

Part of Pro
15

Explain the concept of database normalization and its forms.

Part of Pro
16

What are indexes and how do they improve query performance?

Part of Pro
17

What are subqueries and what types exist?

Part of Pro
18

Explain the difference between clustered and non-clustered indexes.

Part of Pro
19

What are Common Table Expressions (CTEs) and when would you use them?

Part of Pro
20

What are stored procedures and their advantages?

Part of Pro
21

What's the difference between correlated and non-correlated subqueries?

Part of Pro
22

What are triggers and when should you use them?

Part of Pro
23

How do you find duplicate records in a table?

Part of Pro
24

Explain the execution order of SQL clauses.

Part of Pro
25

What's the difference between RANK(), DENSE_RANK(), and ROW_NUMBER()?

Part of Pro
26

Explain the concept of database transactions.

Part of Pro
27

What are the advantages and disadvantages of using indexes?

Part of Pro
28

What's the difference between EXISTS and IN operators?

Part of Pro
29

How do you implement pagination in SQL?

Part of Pro
30

What are user-defined functions and how do they differ from stored procedures?

Part of Pro
31

What is a self-join and when would you use it?

Part of Pro
Expert 10
32

Explain ACID properties in database transactions.

Part of Pro
33

What are Window Functions and how do they differ from aggregate functions?

Part of Pro
34

Explain different isolation levels in databases.

Part of Pro
35

How do you optimize slow SQL queries?

Part of Pro
36

Explain the concept of database locks and their types.

Part of Pro
37

How do you handle hierarchical data in SQL?

Part of Pro
38

How do you calculate running totals and moving averages?

Part of Pro
39

Explain SQL injection and how to prevent it.

Part of Pro
40

How do you implement row-level security in SQL?

Part of Pro
41

Explain database partitioning and its benefits.

Part of Pro

No matches

Try a different filter or search term.

Pro · $10/mo

35 of 41 SQL Fundamentals answers are gated.

Full answers, code samples, AI explanations - simpler, deeper, or as an interactive diagram. Cancel anytime.

  • Full answers + code
  • AI explain - simpler, deeper, or visualized
  • 1,000 AI credits / month
  • Cancel anytime

Change topic

Pick a different technology or stack. Your current topic stays put until you choose a new one.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

JAM

JavaScript, APIs, and Markup

Serverless on AWS

Serverless Architecture on AWS

Cross-cutting topics 43 topics

Interviewers also test these - they're common to every stack, whichever one you picked above.

Flutter Mobile

Flutter Cross-Platform Mobile Development

Cross-cutting topics 44 topics

Interviewers also test these - they're common to every stack, whichever one you picked above.

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

Web3 / Ethereum

Solidity, Ethereum, Hardhat, Foundry

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git
Big-O & Complexity Analysis Arrays, Strings & Hash Tables Linked Lists, Stacks & Queues Trees, BSTs & Heaps Graphs Sorting, Searching & Recursion Operating Systems Concurrency & Multithreading Networking for Developers Git & Version Control API Design 45 Distributed Systems Fundamentals 34

Cross-cutting topics 43 topics

Interviewers also test these - they're common to every stack, whichever one you picked above.


Cross-cutting topics 45 topics

Interviewers also test these - they're common to every stack, whichever one you picked above.