一、创建数据库(使用B)
A. 我的原数据库设计
--create database for restruant management system
USE master
DROP DATABASE RMSDB
CREATE DATABASE RMSDB
GO
USE RMSDB
--create base tables
DROP TABLE Houses
CREATE TABLE Houses
(
HID int IDENTITY(1,1) PRIMARY KEY,
--房间编号
alias varchar(20),
--房间的别称
description varchar(100),
--房间的描述
capity int NOT NULL
--房间的旅客容量
)
DROP TABLE Menus
CREATE TABLE Menus
(
MID int IDENTITY(1,1) PRIMARY KEY,
--菜单编号
mName varchar(20) NOT NULL,
--菜单名称
price float NOT NULL
--菜单价格
)
DROP TABLE Tables
CREATE TABLE Tables
(
TID int IDENTITY(1,1) PRIMARY KEY,
tAlias varchar(20)
)
DROP TABLE Customers
CREATE TABLE Customers
(
CID char(20) PRIMARY KEY,
cName varchar(20),
cAddress varchar(40),
cPhone varchar(20)
)
DROP TABLE Staffs
CREATE TABLE Staffs
(
SID VARCHAR(6) PRIMARY KEY,
username VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
sName VARCHAR(20) NOT NULL,
address VARCHAR(40),
phone VARCHAR(20),
sPosition VARCHAR(20)
--position including manager or common staffs
)
DROP TABLE Notice
CREATE TABLE Notice
(
NID int IDENTITY(1,1) PRIMARY KEY,
title NCHAR(20) NOT NULL,
content NCHAR(200)
)
GO