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]