Slide 14.6: SQL (Structured Query Langauge) Slide 14.8: The INSERT INTO statement Home |
CREATE TABLE
Statement
The syntax of creating a table in a database is given on the right. |
|
The example on the right demonstrates how to create a table named Persons , with four columns: LastName , FirstName , Address , and City :
|
|
Data Type | Description |
---|---|
integer(size)
|
Hold integers only. The maximum number of digits are specified in parenthesis.
|
decimal(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.
|