All questions
of 41What is SQL and what are its main components?
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:
Last attempt -
- 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
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 →
What's the difference between DELETE, TRUNCATE, and DROP?
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:
Last attempt -
- 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
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 →
What is a Primary Key and what are its characteristics?
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:
Last attempt -
- 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
);
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 →
What's the difference between WHERE and HAVING clauses?
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:
Last attempt -
- 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;
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 →
What's the difference between UNION and UNION ALL?
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:
Last attempt -
- 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;
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 →
What are constraints and what types are available?
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:
Last attempt -
- 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)
);
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 →
How do you handle NULL values in SQL?
What's the difference between a view and a table?
What's the difference between CHAR and VARCHAR data types?
What are the different types of database relationships?
What are aggregate functions and how do they work with GROUP BY?
How do you perform case-insensitive searches in SQL?
What are database functions and what types exist?
Explain the different types of SQL JOINs.
Explain the concept of database normalization and its forms.
What are indexes and how do they improve query performance?
What are subqueries and what types exist?
Explain the difference between clustered and non-clustered indexes.
What are Common Table Expressions (CTEs) and when would you use them?
What are stored procedures and their advantages?
What's the difference between correlated and non-correlated subqueries?
What are triggers and when should you use them?
How do you find duplicate records in a table?
Explain the execution order of SQL clauses.
What's the difference between RANK(), DENSE_RANK(), and ROW_NUMBER()?
Explain the concept of database transactions.
What are the advantages and disadvantages of using indexes?
What's the difference between EXISTS and IN operators?
How do you implement pagination in SQL?
What are user-defined functions and how do they differ from stored procedures?
What is a self-join and when would you use it?
Explain ACID properties in database transactions.
What are Window Functions and how do they differ from aggregate functions?
Explain different isolation levels in databases.
How do you optimize slow SQL queries?
Explain the concept of database locks and their types.
How do you handle hierarchical data in SQL?
How do you calculate running totals and moving averages?
Explain SQL injection and how to prevent it.
How do you implement row-level security in SQL?
Explain database partitioning and its benefits.
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
SQL Fundamentals cheatsheet
SQL Fundamentals Interview Cheat Sheet
- Summary01
- 1. SQL Basics02
- 2. Data Types03
- 3. DDL Commands04
- 4. DML Commands05
- 5. Filtering & Operators06
- 6. Joins07
- 7. Aggregate Functions & Grouping08
- 8. Subqueries09
- 9. Set Operations10
- 10. Constraints11
- 11. Views12
- + 10 more inside
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.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsLAMP
Linux, Apache, MySQL, PHPRuby on Rails
Convention over ConfigurationJAM
JavaScript, APIs, and MarkupServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQFastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseWeb3 / Ethereum
Solidity, Ethereum, Hardhat, FoundryDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.