Acronym for Structured Query Language. Some DataBase professionals think the S should stand for "stupid."

SQL is a set-centric ProgrammingLanguage in which statements are excuted over a Schema of relations (tables), and return a table of results.

Syntax and examples

In this example, imagine we have a table called users which has an id, a name and an accesslevel column.

Retrieving data:

SELECT col_1, col_2, col_n FROM table WHERE condition

Eg. to find the access level of user number 154:

SELECT accesslevel FROM users WHERE id = 154;

Inserting data:

INSERT INTO table (column_one, column_..., column_n) VALUES (value_one, value_..., value_n)

Eg. to add a new user:

INSERT INTO users (name, accesslevel) VALUES ('Craig', 10);

The next available ID number is automatically assigned.

Updating data:

UPDATE table SET column_onevalue_one, column_...value_..., column_n=value_n WHERE condition

Eg. to set an accesslevel of 15 to everyone whos name starts with a C:

UPDATE users SET accesslevel=15 WHERE name LIKE 'C%';

Removing data:

DELETE FROM table WHERE condition

Eg. to remove the user with ID number 30:

DELETE FROM users WHERE id = 30;

Part of CategoryProgrammingLanguages and CategorySpecialPurposeProgrammingLanguages