SQL Commands

A database consists of one or more tables. A table is identified by its name. A table is made up of columns and rows. Columns contain the column name and data type. Rows contain the records or data for the columns.

Each record has a unique identifier or primary key. SQL, which stands for Structured Query Language, is used to communicate with a database. Through SQL one can create and delete tables. Here are some commands:

SQL also has syntax to update, insert, and delete records.

The SELECT is used to query the database and retrieve selected data that match the specific criteria that you specify:

SELECT "column1" [, "column2", ...]
FROM "tablename"
WHERE "condition"
The conditional clause can include these operators

The CREATE TABLE statement is used to create a new table. The format is:
CREATE TABLE "tablename"
("column1" "data type",
"column2" "data type",
"column3" "data type");

Once a table has been created data can be inserted using INSERT INTO command.
INSERT INTO "tablename"
(col1, ... , coln)
VALUES (val1, ... , valn)

To change the data values in a pre existing table, the UPDATE command can be used.
UPDATE "tablename"
SET "colX" = "valX" [, "colY" = "valY", ...]
WHERE "condition"

The DELETE command can be used to remove a record(s) from a table.
DELETE FROM "tablename"
WHERE "condition"

To remove an entire table from the database use the DROP command.
DROP TABLE "tablename"