C#在线音乐信息查询和管理系统设计(6)
时间:2017-05-31 19:27 来源:毕业论文 作者:毕业论文 点击:次
表user中username为主键,其他属性依赖于username,所以满足BC范式。 3.5 创建语句 创建album表: CREATE TABLE [dbo].[album]( [acode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [aname] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [time] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, [cover] [image] NOT NULL, CONSTRAINT [PK_album_1] PRIMARY KEY CLUSTERED 创建group表: CREATE TABLE [dbo].[group]( [gname] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [gcode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, CONSTRAINT [PK_group_1] PRIMARY KEY CLUSTERED 创建song表: CREATE TABLE [dbo].[song]( [sname] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [track] [char](2) COLLATE Chinese_PRC_CI_AS NOT NULL, [arranger] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [lyric] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, [vocal] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, [oricode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [style] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, [scode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [adduser] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK_song_1] PRIMARY KEY CLUSTERED ( [scode] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO USE [touhou music] GO ALTER TABLE [dbo].[song] WITH CHECK ADD CONSTRAINT [FK_song_ori] FOREIGN KEY([oricode]) REFERENCES [dbo].[ori] ([oricode]) 创建gas表: CREATE TABLE [dbo].[gas]( [gcode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [acode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [scode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, CONSTRAINT [PK_gas] PRIMARY KEY CLUSTERED ( [gcode] ASC, [acode] ASC, [scode] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO USE [touhou music] GO ALTER TABLE [dbo].[gas] WITH CHECK ADD CONSTRAINT [FK_gas_album] FOREIGN KEY([acode]) REFERENCES [dbo].[album] ([acode]) GO ALTER TABLE [dbo].[gas] WITH CHECK ADD CONSTRAINT [FK_gas_group] FOREIGN KEY([gcode]) REFERENCES [dbo].[group] ([gcode]) GO ALTER TABLE [dbo].[gas] WITH CHECK ADD CONSTRAINT [FK_gas_song] FOREIGN KEY([scode]) REFERENCES [dbo].[song] ([scode]) 创建ori表: CREATE TABLE [dbo].[ori]( [oricode] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [origin] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, CONSTRAINT [PK_ori] PRIMARY KEY CLUSTERED ( [oricode] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] 创建user表: CREATE TABLE [dbo].[user]( [username] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [password] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [autho] [char](1) COLLATE Chinese_PRC_CI_AS NOT NULL, [quest] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, [ans] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, (责任编辑:qin) |