0% found this document useful (0 votes)
2 views

SQL_Commands_Overview (1)

The document provides an overview of essential SQL commands, including SELECT, CREATE DATABASE, DROP DATABASE, CREATE TABLE, ALTER TABLE, INSERT, UPDATE, DELETE, CREATE INDEX, and DROP INDEX. Each command is accompanied by a brief description of its function and syntax. This serves as a quick reference for performing basic database operations.

Uploaded by

hamoh57753
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

SQL_Commands_Overview (1)

The document provides an overview of essential SQL commands, including SELECT, CREATE DATABASE, DROP DATABASE, CREATE TABLE, ALTER TABLE, INSERT, UPDATE, DELETE, CREATE INDEX, and DROP INDEX. Each command is accompanied by a brief description of its function and syntax. This serves as a quick reference for performing basic database operations.

Uploaded by

hamoh57753
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL Commands Overview

1. SELECT Command:

SELECT * FROM employees WHERE age > 30 ORDER BY name ASC;

- Retrieves all columns from the 'employees' table where the 'age' is greater than 30.

Results are sorted by the 'name' column in ascending order.

2. CREATE DATABASE:

CREATE DATABASE database_name;

- Creates a new database with the specified name.

3. DROP DATABASE:

DROP DATABASE database_name;

- Deletes the specified database.

4. CREATE TABLE:

CREATE TABLE table_name (

column1 datatype constraints,

column2 datatype constraints

);

- Creates a new table with the specified structure.

5. ALTER TABLE:

ALTER TABLE table_name ADD column_name datatype;

- Modifies an existing table, e.g., adds a new column.


6. INSERT Command:

INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);

- Inserts data into the specified table.

7. UPDATE Command:

UPDATE table_name SET column1 = value1 WHERE condition;

- Updates data in the table based on the condition.

8. DELETE Command:

DELETE FROM table_name WHERE condition;

- Deletes rows from the table based on the condition.

9. CREATE INDEX:

CREATE INDEX index_name ON table_name (column_name);

- Creates an index on the specified column to improve query performance.

10. DROP INDEX:

DROP INDEX index_name;

- Deletes an index from the table.

You might also like