SQL Language Elements

SELECT

Retrieves rows from one or more tables.

SELECT column1, column2 FROM table_name WHERE condition;

INSERT

Adds new rows to a table.

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

UPDATE

Modifies existing rows in a table.

UPDATE table_name SET column1 = value1 WHERE condition;

DELETE

Removes rows from a table.

DELETE FROM table_name WHERE condition;

CREATE

Creates database objects such as tables, views, or procedures.

CREATE TABLE Employees (ID int, Name varchar(100));

ALTER

Modifies existing database objects.

ALTER TABLE Employees ADD Salary decimal(10,2);

DROP

Deletes database objects.

DROP TABLE Employees;

JOIN

Combines rows from two or more tables based on related columns.

SELECT * FROM Orders o JOIN Customers c ON o.CustomerID = c.ID;

WHERE

Filters rows based on a condition.

SELECT * FROM Employees WHERE Salary > 50000;