为这三个表添加以下数据(每个表只需写出一条增加数据的SQL语句)

1个回答

  • CREATE TABLE [dbo].[书店表] (

    [书店编号] [nvarchar] (6) COLLATE Chinese_PRC_CI_AS NOT NULL ,

    [店名] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL ,

    [电话] [char] (8) COLLATE Chinese_PRC_CI_AS NULL ,

    [地址] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,

    [邮政编码] [char] (6) COLLATE Chinese_PRC_CI_AS NULL

    ) ON [PRIMARY]

    GO

    CREATE TABLE [dbo].[图书表] (

    [书号] [nvarchar] (6) COLLATE Chinese_PRC_CI_AS NOT NULL ,

    [书名] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL ,

    [第一作者] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,

    [出版日期] [smalldatetime] NULL ,

    [价格] [numeric](4, 1) NULL

    ) ON [PRIMARY]

    GO

    CREATE TABLE [dbo].[图书销售表] (

    [书号] [nvarchar] (6) COLLATE Chinese_PRC_CI_AS NOT NULL ,

    [书店编号] [nvarchar] (6) COLLATE Chinese_PRC_CI_AS NOT NULL ,

    [销售日期] [smalldatetime] NOT NULL ,

    [销售数量] [smallint] NULL

    ) ON [PRIMARY]

    GO

    ALTER TABLE [dbo].[书店表] WITH NOCHECK ADD

    CONSTRAINT [PK_书店表] PRIMARY KEY CLUSTERED

    (

    [书店编号]

    ) ON [PRIMARY]

    GO

    ALTER TABLE [dbo].[图书表] WITH NOCHECK ADD

    CONSTRAINT [PK_图书表] PRIMARY KEY CLUSTERED

    (

    [书号]

    ) ON [PRIMARY]

    GO

    ALTER TABLE [dbo].[图书销售表] WITH NOCHECK ADD

    CONSTRAINT [PK_图书销售表] PRIMARY KEY CLUSTERED

    (

    [书号],

    [书店编号],

    [销售日期]

    ) ON [PRIMARY]

    GO