Penguin
Note: You are viewing an old revision of this page. View the current version.

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 set of results.

Syntax & examples

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

Retrieving data:

SELECT cols FROM tables WHERE condition
eg to find the access level of user number 154: SELECT accesslevel FROM users WHERE id = 154;

Inserting data:

INSERT INTO table (columns) VALUES (values)
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=value 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 Remove user with ID number 30: DELETE FROM users WHERE id = 30;


CategoryProgrammingLanguages, CategorySpecialPurposeProgrammingLanguages