You are on page 1of 2

DATABSE QUẢN LÍ BÁN CAFÉ

CREATE DATABASE COFFE


go
USE COFFE
go
CREATE TABLE tablef
(
id int identity PRIMARY KEY,
name varchar(100) not null default N'chua có tên bàn',
status nvarchar(100) not null default 0,
)
go
CREATE TABLE account
(
username nvarchar(100) primary key,
displayname nvarchar(100) not null default 'user',
password nvarchar(1000) not null default'1234',
type int not null default 0,

)
go
CREATE TABLE foodf
(
id int identity primary key,
name varchar(100) not null default'chua dat ten',

)
go
CREATE TABLE food
(
id int identity primary key,
name nvarchar(100) not null default 'chua dat ten',
idfood int not null,
price float not null default 0,
foreign key(idfood) REFERENCES dbo.foodf(id),
)
go
CREATE TABLE bill
(
id int identity primary key ,
datecheckin date not null default getdate(),
datecheckout date,
idtable int not null,
status int not null default 0
foreign key (idtable) REFERENCES dbo.tablef(id),

)
go
CREATE TABLE billinfo
(
id int identity primary key,
idbill int not null,
idfood int not null,
count int not null default 0,

foreign key (idbill) REFERENCES dbo.bill(id),


foreign key(idfood) REFERENCES dbo.foodf(id),
)
go

You might also like