0% found this document useful (0 votes)
20 views2 pages

SQL Cheat Sheet

The document is a SQL cheat sheet that outlines basic SQL commands including SELECT, WHERE, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, and DELETE. Each command is accompanied by its syntax and an example for clarity. It serves as a quick reference guide for performing common database operations.

Uploaded by

Avni Pander
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

SQL Cheat Sheet

The document is a SQL cheat sheet that outlines basic SQL commands including SELECT, WHERE, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, and DELETE. Each command is accompanied by its syntax and an example for clarity. It serves as a quick reference guide for performing common database operations.

Uploaded by

Avni Pander
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

25/07/2025, 09:39 about:blank

SQL Cheat Sheet: Basics

Command Syntax Description Example

SELECT
statement is
SELECT column1, column2, ... used to
SELECT SELECT city FROM placeofinterest;
FROM table_name; fetch data
from a
database.

WHERE
clause is
used to
extract only
SELECT column1, column2, ...FROM
WHERE table_name WHERE condition;
those SELECT * FROM placeofinterest WHERE city = 'Rome' ;
records that
fulfill a
specified
condition.

COUNT is a
function
that takes
the name of
a column as
SELECT COUNT * FROM table_name ;
argument SELECT COUNT(country) FROM placeofinterest WHERE
COUNT country='Canada';
and counts
the number
of rows
when the
column is
not NULL.

DISTINCT
function is
used to
specify that
the
statement is
SELECT DISTINCT columnname FROM SELECT DISTINCT country FROM placeofinterest WHERE
DISTINCT a query
table_name; type='historical';
which
returns
unique
values in
specified
columns.

LIMIT is a
clause to
specify the
SELECT * FROM table_name LIMIT maximum SELECT * FROM placeofinterest WHERE
LIMIT number; airport="pearson" LIMIT 5;
number of
rows the
result set
must have.

INSERT is
INSERT INTO table_name used to INSERT INTO placeofinterest
INSERT (column1,column2,column3...) insert new (name,type,city,country,airport) VALUES('Niagara
VALUES(value1,value2,value3...); rows in the Waterfalls','Nature','Toronto','Canada','Pearson');
table.

UPDATE
used to
UPDATE table_name SET[[column1]= UPDATE placeofinterest SET name = 'Niagara Falls'
UPDATE update the
[VALUES]] WHERE [condition]; WHERE name = "Niagara Waterfalls";
rows in the
table.

about:blank 1/2
25/07/2025, 09:39 about:blank

DELETE
statement is
used to
remove
rows from
DELETE FROM table_name WHERE DELETE FROM placeofinterest WHERE city IN
DELETE [condition];
the table ('Rome','Vienna');
which are
specified in
the
WHERE
condition.

Author(s)
Malika Singla

about:blank 2/2

You might also like