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

SQL Cheat Sheet - Basics

This document is a SQL cheat sheet outlining basic SQL commands and their syntax. It includes examples for SELECT, WHERE, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, and DELETE statements. Each command is briefly described along with its purpose in database management.

Uploaded by

kaif mohammad
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)
10 views2 pages

SQL Cheat Sheet - Basics

This document is a SQL cheat sheet outlining basic SQL commands and their syntax. It includes examples for SELECT, WHERE, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, and DELETE statements. Each command is briefly described along with its purpose in database management.

Uploaded by

kaif mohammad
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

11/22/24, 12:07 AM about:blank

SQL Cheat Sheet: Basics

Command Syntax Description Example

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

from a
database.

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

COUNT is a
function
that takes
the name of
a column as
argument SELECT COUNT(country) FROM placeofinte
COUNT SELECT COUNT * FROM table_name ;
and counts country='Canada';
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 placeofin
DISTINCT a query
table_name; type='historical';
which
returns
unique
values in
specified
columns.

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

about:blank 1/2
11/22/24, 12:07 AM about:blank

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) VALUE
VALUES(value1,value2,value3...); rows in the Waterfalls','Nature','Toronto','Canada
table.

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

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

Author(s)
Malika Singla

about:blank 2/2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy