You can then use an INSERT command to insert data into the relation
Or better, use one of the vendor's provided data loading tools to "bulk insert" data into a relation
(Such tools can even load data from a spreadsheet into a table)
CREATE TABLE relation_name
(
attr_name1 type1 [attr_constraint1] ,
attr_name2 type2 [attr_constraint2] ,
....
attr_namen typen [attr_constraintn]
[ , integrity constrains ]
);
|
Defines a relation named relation_name with attributes:
The available data types is an more varied than the data types available in a programming language
|
|
fixed point numbers are accurate and do NOT have round off errors Example:
NOTE:
|
|
|
|
SQL includes the number of characters of the string when it stores a VARCHAR value In total, VARCHAR(n) stores n + 2 bytes, the 2 extra bytes is for the string length |
NOTE: To denote string, use single quotes: 'John'
|
|
NOTE: To denote bit string 10101, use: B'10101'
|
NOTE:
|
When comparing two values x and y, if either
x
or
y
is
NULL ,
then some logical comparisons
evaluate to an UNKNOWN
value rather than true or false, e.g.:
|
|
NOTE:
|
NOTE:
|
NOTE:
|
CREATE TABLE test
(
name char(10),
addr varchar(10),
id int,
salary dec(9,2),
bdate date
);
|
INSERT INTO test values
(
'John',
'123 H Lane',
12345,
45000.65,
DATE'1970-4-1'
);
|
SELECT * from test; |
DROP TABLE test; |
show databases list all databases in mySQL use DBName Set current DB to DBName show tables List the tables in the current DB SELECT DATABASE() Return the name of the current DB describe TableName Display the structure of table TableName |