电影票务系统(DB)

时间:2017-01-03 10:29:47

标签: sql database model-view-controller

我在MVC上制作了一个在线电影预订系统,我在数据库部分停留在表格如何相互链接上。看起来好吗? ERD

CREATE TABLE [dbo].[Member] 
(
    [memberID] INT IDENTITY (1, 1) NOT NULL,
    [memFirstName]    VARCHAR (50) NULL,
    [memLastName]     VARCHAR (50) NULL,
    [memEmailAddress] VARCHAR (50) NULL,
    [memPassword]     VARCHAR (15) NULL,
    [memTelephone]    CHAR (10)    NULL,
    [memAddress]      VARCHAR (70) NULL,
    PRIMARY KEY CLUSTERED ([memberID] ASC)
);

CREATE TABLE [dbo].[Movie]
(
    [movieID]       INT           IDENTITY (1, 1) NOT NULL,
    [movieName]     VARCHAR (100) NULL,
    [movieCategory] CHAR (10)     NULL,
    PRIMARY KEY CLUSTERED ([movieID] ASC)
);

CREATE TABLE [dbo].[Reservation] 
(
    [resID]    INT IDENTITY (1, 1) NOT NULL,
    [memberID] INT NOT NULL,
    [showID]   INT NOT NULL,
    PRIMARY KEY CLUSTERED ([resID] ASC),
    FOREIGN KEY ([memberID]) REFERENCES [dbo].[Member] ([memberID]),
    FOREIGN KEY ([showID]) REFERENCES [dbo].[Show] ([showID])
);

CREATE TABLE [dbo].[Show] 
(
    [showID]       INT      IDENTITY (1, 1) NOT NULL,
    [showDateTime] DATETIME NOT NULL,
    [movieID]      INT      NULL,
    CONSTRAINT [PK_Show] PRIMARY KEY CLUSTERED ([showID] ASC),
    FOREIGN KEY ([showID]) REFERENCES [dbo].[Movie] ([movieID])    
);

0 个答案:

没有答案