SQL statements
CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
.......
)
INSERT INTO table_name [(column1, column2,...)]
VALUES (value1, value2,....)
UPDATE table_name
[ SET column_name = new_value]
WHERE column_name = some_value
DELETE FROM table_name
WHERE column_name = some_value
DROP TABLE table_name {To delete a table.}
DELETE TABLE table_name {To delete the data in a table without deleting the table.}
The data type specifies what type of data the column can hold. The table below contains the most common data types in SQL:
| Data Type | Description |
|---|---|
| integer(size) int(size) smallint(size) tinyint(size) |
Hold integers only. The maximum number of digits are specified in parenthesis. |
| decimal(size,d) numeric(size,d) |
Hold numbers with fractions. The maximum number of digits are specified in "size". The maximum number of digits to the right of the decimal is specified in "d". |
| char(size) | Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis. |
| varchar(size) | Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis. |
| date(yyyymmdd) | Holds a date |