- A relational database is an organization of related tables
- A table consists of columns and rows
- Each row represents an instance of an entity
- Each column represents an attribute fo the entity instance
Note!
ALL FIELDS ARE NOT MADE THE SAME!
- The data type of a column defines what values the column can hold
- INT
- VARCHAR
- NVARCHAR
- DATE
- DATETIME
- FLOAT
- DOUBLE
- Specify rules for the data at the column level
- NULL or NOT NULL in each column
- UNIQUE
- PRIMARY KEY, FOREIGN KEY
- DEFAULT
CREATE TABLE Customer(
CustomerID int(4) NOT NULL,
FirstName nvarchar(50) NOT NULL,
LastName nvarchar(50) NOT NULL,
Email nvarchar(50) NULL,
Phone nvarchar(50) NULL,
Address nvarchar(50) NOT NULL,
City nvarchar(50) NOT NULL,
State nvarchar(50) NOT NULL,
Zipcode int NOT NULL
)- Data types ensure that the data is kept consistent