日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

微軟官方提供-Northwind(電子商務(wù))-數(shù)據(jù)庫(kù)設(shè)計(jì)

 昵稱10504424 2013-02-25

微軟官方提供-Northwind(電子商務(wù))-數(shù)據(jù)庫(kù)設(shè)計(jì)

ylbtech-DatabaseDesgin:微軟官方提供-Northwind(電子商務(wù))-數(shù)據(jù)庫(kù)設(shè)計(jì)
 
1.A,數(shù)據(jù)庫(kù)關(guān)系圖

 

1.B,數(shù)據(jù)庫(kù)設(shè)計(jì)腳本(此腳本的注釋,是在下根據(jù)一些資料所注,如有不妥當(dāng)之處,望給予矯正,謹(jǐn)謝。)
View Code
復(fù)制代碼
-- ============================================= 
-- ylb:電子商務(wù)模板 
-- author:YUANBO 
-- development time:2011-11-9 
-- thank you:LiuGaiZhen 
-- ============================================= 
USE master 
GO 
  
-- Drop the database if it already exists 
IF  EXISTS ( 
    SELECT name 
        FROM sys.databases  
        WHERE name = N'EShop'
) 
DROP DATABASE EShop 
GO 
  
CREATE DATABASE EShop 
GO 
use EShop 
  
go 
-- ============================================= 
-- 1,供應(yīng)商 
-- ============================================= 
create table Suppliers 
( 
SupplierID int identity(1,1) primary key,   --供應(yīng)商ID [PK] 
CompanyName nvarchar(40) not null,          --公司名稱 
ContactName nvarchar(30),           --聯(lián)系人姓名 
ContactTitle nvarchar(30),          --聯(lián)系人頭銜 
[Address] nvarchar(60),             --地址 
  
City nvarchar(15),                  --城市 
Region nvarchar(15),                --地區(qū) 
PostalCode nvarchar(15),            --郵政編碼 
Country nvarchar(24),               --國(guó)家 
Phone nvarchar(24),                 --電話 
  
Fax nvarchar(24),           --傳真 
HomePage ntext              --主頁(yè) 
) 
  
go 
-- ============================================= 
-- 2,類別 
-- ============================================= 
create table Categories 
( 
CategoryID int identity(1,1) primary key,   --類別ID  [PK] 
CategoryName nvarchar(15) not null, --類別名稱 
[Description] ntext,                --說(shuō)明 
Picture image                       --圖片 
) 
  
go 
-- ============================================= 
--3,產(chǎn)品  
-- ============================================= 
create table Products 
( 
ProductID int identity primary key, --產(chǎn)品ID『PK』 
ProductName nvarchar(40) not null,  --產(chǎn)品名稱 
SupplierID int foreign key references Suppliers(SupplierID),                        --供應(yīng)商ID 
CategoryID int foreign key references Categories(CategoryID),                   --類別ID 
QuantityPerUnit nvarchar(20),   --單位數(shù)量 
  
UnitPrice money,            --單價(jià) 
UnitsInStock smallint default(0) check(UnitsInStock>=0),     --庫(kù)存量 
UnitsOnOrder smallint default(0) check(UnitsOnOrder>=0),     --訂購(gòu)量 
ReorderLevel smallint default(0) check(ReorderLevel>=0),     --再訂購(gòu)量 
Discontinued bit            --中止 
) 
  
go 
-- ============================================= 
-- 4,訂單明細(xì) 
-- ============================================= 
create table OrderDetails 
( 
OrderID int identity(1,1),      --訂單ID 
ProductID int,      --產(chǎn)品ID   
UnitPrice money not null,   --單價(jià) 
Quantity smallint not null, --數(shù)量 
Discount real not null,     --折扣 
  
primary key(OrderID,ProductID)  --聯(lián)合主鍵 
) 
  
go 
-- ============================================= 
-- 5,雇員 
-- P:1,ReportsTo; 2,baseID 
-- ============================================= 
create table Employees 
( 
EmployeeID int identity(1,1) primary key,   --雇員ID【PK】 
lastName nvarchar(20) not null,             --姓氏 
FirstName nvarchar(10) not null,            --名字 
Title nvarchar(30),     --頭銜 
TitleOfCourtesy nvarchar(25),       --尊稱 
  
BirthDate datetime,     --出生日期 
HireDate datetime,      --雇傭日期 
[Address] nvarchar(50), --地址 
City nvarchar(15),      --城市 
Region nvarchar(15),    --地區(qū) 
  
PostalCode nvarchar(10),    --郵政編碼 
Country nvarchar(15),       --國(guó)家 
HomePhone nvarchar(24),     --家庭電話 
Extension nvarchar(4),      --分機(jī) 
Photo image,                --照片 
  
Notes ntext,        --備注 
--ReportsTo int FK 
PhotoPath nvarchar(255) --圖片地址 
--baseID    --上級(jí)編號(hào) 
) 
  
go 
-- ============================================= 
-- 6,客戶 
-- ============================================= 
create table Customers 
( 
CustomerID nchar(5) primary key,    --客戶ID【PK】 
CompanyName nvarchar(40) not null,  --公司名稱 
ContactName nvarchar(30),           --聯(lián)系人姓名 
ContactTitle nvarchar(30),          --聯(lián)系人頭銜 
[Address] nvarchar(60),             --地址 
  
City nvarchar(15),      --城市 
Region nvarchar(15),    --地區(qū) 
PostalCode nvarchar(15),--郵政編號(hào)   
Country nvarchar(24),   --國(guó)家 
Phone nvarchar(24),     --電話 
  
Fax nvarchar(24)        --傳真 
) 
  
go 
-- ============================================= 
-- 7,客戶演示圖形 
-- ============================================= 
create table CustomerDemoGraphics 
( 
CustomerTypeID nchar(10) primary key,   --客戶演示圖形ID 【PK】 
CustomerDesc ntext                      --客戶描述 
) 
  
go 
-- ============================================= 
-- 7,客戶演示圖形 
-- ============================================= 
create table CustomerCustomerDemo 
( 
CustomerID nchar(5) foreign key references Customers(CustomerID),   --客戶ID【PK,F(xiàn)K】 
CustomerTypeID nchar(10) foreign key references CustomerDemoGraphics(CustomerTypeID), --客戶演示圖形ID【PK,F(xiàn)K】 
primary key(CustomerID,CustomerTypeID) 
) 
  
go 
-- ============================================= 
-- 7,訂單 
-- ============================================= 
create table Orders 
( 
OrderID int identity primary key,   --訂單ID【PK】 
CustomerID nchar(5) foreign key references Customers(CustomerID),   --客戶ID【FP】 
EmployeeID int foreign key references Employees(EmployeeID),    --雇員ID【FP】 
OrderDate datetime,     --訂購(gòu)日期 
RequiredDate datetime,  --到貨日期 
  
ShippedDate datetime,   --發(fā)貨日期 
--ShipVia int FK        --運(yùn)貨商 
Fright money,           --運(yùn)貨費(fèi) 
ShipName nvarchar(15),      --貨主名稱 
ShipAddress nvarchar(60),   --貨主地址 
  
ShipCity nvarchar(15),      --貨主城市 
ShipRegion nvarchar(15),    --貨主地區(qū) 
ShipPostalCode nvarchar(10),--貨主郵政編碼     
ShipContry nvarchar(15)     --貨主國(guó)家 
) 
  
-- ============================================= 
-- 8,運(yùn)貨商 
-- ============================================= 
create table Shippers 
( 
ShipperID int identity primary key,     --運(yùn)貨商ID【PK】 
CompanyName nvarchar(40) not null,      --公司名稱 
Phone nvarchar(24)                      --電話 
) 
  
print 'ylb, tech 創(chuàng)建電子商務(wù)數(shù)據(jù)庫(kù)完成' 
復(fù)制代碼
1.C,功能實(shí)現(xiàn)代碼

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多