SQL Cheatsheet
This page is a quick reference for commonly used SQL commands and database operations. Whether you're preparing for interviews, learning DBMS, or building backend applications, this cheatsheet covers the essentials.
Video Explanation

Database Operations
Create Database
CREATE DATABASE company_db;
Use Database
USE company_db;
Delete Database
DROP DATABASE company_db;
Table Operations
Create Table
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(100),
department VARCHAR(50),
salary DECIMAL(10,2),
joining_date DATE
);
View Table Structure
DESC employees;
Rename Table
RENAME TABLE employees TO staff;
Delete Table
DROP TABLE employees;
Insert Data
Insert Single Row
INSERT INTO employees
VALUES (1, 'John Doe', 'IT', 50000, '2025-01-15');
Insert Multiple Rows
INSERT INTO employees
VALUES
(2, 'Alice', 'HR', 45000, '2025-02-10'),
(3, 'Bob', 'Finance', 55000, '2025-03-05');
Select Queries
Select All Data
SELECT * FROM employees;
Select Specific Columns
SELECT name, salary
FROM employees;
Distinct Values
SELECT DISTINCT department
FROM employees;