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

Essential SQL Commands Guide

The document outlines various SQL commands categorized into Data Definition Language (DDL) and Data Manipulation Language (DML). Key commands include CREATE, INSERT, DROP, ALTER, UPDATE, DELETE, and SELECT, along with clauses like LIKE, IN, BETWEEN, and functions such as MIN, MAX, COUNT, and AVG. Each command is presented with its syntax for easy reference.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Essential SQL Commands Guide

The document outlines various SQL commands categorized into Data Definition Language (DDL) and Data Manipulation Language (DML). Key commands include CREATE, INSERT, DROP, ALTER, UPDATE, DELETE, and SELECT, along with clauses like LIKE, IN, BETWEEN, and functions such as MIN, MAX, COUNT, and AVG. Each command is presented with its syntax for easy reference.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

SQL Commands

1. CREATE (DDL)
- CREATE DATABASE databaseName;

2. INSERT (DML)
- INSERT INTO tableName (column1, column2, column3....)
VALUES(value1, value2, value3 ....);

3. DROP (DDL)
- DROP DATABASE databaseName
- DROP TABLE tableName

4. ALTER (DML)
- ALTER TABLE tableName ADD newColumn datatype(size)
- ALTER TABLE tableName DROP COLUMN columnName
- ALTER TABLE tableName MODIFY COLUMN columnName newDatatype(size) PRIMARY KEY
(OPTIONAL)

5. UPDATE (DML)
- UPDATE tableName SET columnName = Value WHERE condition

6. DELETE
- DELETE FROM tableName WHERE condition

7. SELECT (DML)
- SELECT (columnName or *) FROM tableName
- SELECT (columnName or *) FROM tableName WHERE condition

8. LIKE CLAUSE
- SELECT * FROM tableName WHERE columnName LIKE pattern(e.g "a%o")

9. IN CLAUSE
- SELECT * FROM tableName WHERE columnName IN (value1, value2, ....)

10. BETWEEN CLAUSE


- SELECT * FROM tableName WHERE columnName BETWEEN value1 AND value2

11. LIMIT Clause


- SELECT * FROM tableName LIMIT value (e.g 3)

12. MIN Function


- SELECT MIN(columnName) AS nickName FROM tableName

13. MAX Function


- SELECT MAX(columnName) AS nickName FROM tableName

14 COUNT Function
- SELECT COUNT(columnName) AS nickName FROM tableName WHERE condition

15. AVG Function


- SELECT AVG(columnName) AS nickName FROM tableName

You might also like