| Queries |
A query is simply a sentence that tells the database server what you'd like it to do. |
| Types |
There are three basic types of queries: Add (SELECT), Change (UPDATE) and Get (SELECT). |
| SELECT |
A SELECT query is used to get information from a table.
| Query | | Meaning |
| SELECT first FROM names | | get a list of first names |
| SELECT * FROM names | | get all rows from names |
|
INSERT |
An INSERT query is used to add information to a table.
| Query | | Meaning |
INSERT INTO names (first, middle, last)
VALUES ('Ernest', 'Henry', 'Beernink') | | Add a new name |
|
UPDATE |
An UPDATE query is used to change information in a table.
| Query | | Meaning |
UPDATE names SET first='Alex'
WHERE first='Alexander' |
| Change Alexander to Alex |
|