表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,
- 上一篇:C#旅游网站的设计与实现+源代码
- 下一篇:C#大学生科技创新项目管理系统的设计与实现
-
-
-
-
-
-
-
电站锅炉暖风器设计任务书
十二层带中心支撑钢结构...
乳业同业并购式全产业链...
大众媒体对公共政策制定的影响
河岸冲刷和泥沙淤积的监测国内外研究现状
酸性水汽提装置总汽提塔设计+CAD图纸
中考体育项目与体育教学合理结合的研究
当代大学生慈善意识研究+文献综述
杂拟谷盗体内共生菌沃尔...
java+mysql车辆管理系统的设计+源代码