Skip to content

Instantly share code, notes, and snippets.

@brianium
Created May 30, 2012 03:08
Show Gist options
  • Save brianium/2833487 to your computer and use it in GitHub Desktop.
Save brianium/2833487 to your computer and use it in GitHub Desktop.
SqlServer Script
--Employees
CREATE TABLE Employees(
Id int not null,
LastName nvarchar(50) not null,
MiddleName nvarchar(50),
FirstName nvarchar(50) not null,
primary key(Id)
)
GO
--Customers
CREATE TABLE Customers(
Id int not null,
CustomerIdentifier nvarchar(50) not null,
LastName nvarchar(50) not null,
MiddleName nvarchar(50),
FirstName nvarchar(50) not null,
Line1 nvarchar(100) not null,
Line2 nvarchar(100) not null,
ZipCode nvarchar(10) not null,
City nvarchar(50) not null,
State nchar(2) not null,
primary key(Id)
)
GO
--Orders
CREATE TABLE Orders(
Id int not null,
CustomerId int not null,
EmployeeId int not null,
OrderDate datetime not null,
OrderTotal money not null,
primary key(Id),
constraint FK_Orders_Customers foreign key (CustomerId) references Customers(Id),
constraint FK_Orders_Employees foreign key (EmployeeId) references Employees(Id)
)
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment