SQL Syntax

Last Updated : 10 Sep, 2026

SQL syntax is a set of rules and guidelines used to write and execute SQL queries correctly.

  • Uses specific keywords, clauses and operators to perform database operations.
  • SQL keywords are generally written in uppercase for better readability.

Database Tables

A relational database consists of one or more tables. Each table contains records (rows) and fields (columns). For instance, consider a table named "employee":

1

SQL Statements

SQL statements are commands that perform specific actions on the database. Below are some of the most fundamental SQL statements:

SELECT Statement

The SELECT statement retrieves data from a database. It is one of the most commonly used SQL commands.

SELECT * FROM employee;

INSERT INTO Statement

The INSERT INTO statement adds new rows to a table.

INSERT INTO employee (employee_id, first_name, last_name, birth_date, hire_date, department, position, salary)
VALUES (6, 'David', 'Wilson', '1992-03-18', '2020-09-15', 'Sales', 'Sales Manager', 68000);

UPDATE Statement

The UPDATE statement modifies existing records in a table.

UPDATE employee
SET salary = 80000
WHERE employee_id = 1;

DELETE Statement

The DELETE statement removes existing records from a table.

DELETE FROM employee
WHERE employee_id = 2;

ALTER TABLE Statement

The ALTER TABLE statement modifies an existing table.

ALTER TABLE employee
ADD COLUMN email VARCHAR(255);