0% found this document useful (0 votes)
15 views1 page

1 Dbms Basics

This document is a SQL cheat sheet that outlines basic SQL commands and their syntax. It includes descriptions and examples for commands such as SELECT, WHERE, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, and DELETE. The cheat sheet serves as a quick reference for performing common database operations.

Uploaded by

Aaquib Sattar
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)
15 views1 page

1 Dbms Basics

This document is a SQL cheat sheet that outlines basic SQL commands and their syntax. It includes descriptions and examples for commands such as SELECT, WHERE, COUNT, DISTINCT, LIMIT, INSERT, UPDATE, and DELETE. The cheat sheet serves as a quick reference for performing common database operations.

Uploaded by

Aaquib Sattar
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/ 1

1/4/25, 8:18 PM about:blank

SQL Cheat Sheet: Basics

Command Syntax Description Example

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

WHERE clause is used to extract only


SELECT column1, column2, ...FROM SELECT * FROM placeofinterest WHERE city == 'Rome'
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 and counts the SELECT COUNT(country) FROM placeofinterest WHERE
COUNT SELECT COUNT * FROM table_name ;
number of rows when the column is not country='Canada';
NULL.

DISTINCT function is used to specify


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

LIMIT is a clause to specify the


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

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

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

DELETE statement is used to remove


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

about:blank 1/2

You might also like