SQL Server CREATE TABLE Statement
SQL Server CREATE TABLE Statement
Data Types
1
TP2 BD INFO 2
Numeric column. Precision –
number of digits, Scale – how many DECIMAL(5,2) → 476.29
Decimal (p,s)
of the digits are located after the DECIMAL(5,2) → 6.29
decimal point
For example:
2
TP2 BD INFO 2
3
TP2 BD INFO 2
For example:
UNIQUE (UQ)
4
TP2 BD INFO 2
In SQL Server, the Unique constraint requires that every value in a column
(or set of columns) be unique. The syntax for defining a UNIQUE
Constraint is as follows:
CHECK (CK)
In SQL Server, the Check constraint defines a condition that each row must
satisfy. The syntax for defining a Check Constraint is as follows:
1 column_name column_DataType [DEFAULT value] [CONSTRAINT constraint_name] CHECK (Cond
5
TP2 BD INFO 2
The syntax used for deleting an existing table in SQL Server is as follows :
DROP TABLE table_name
For example
DROP TABLE employees