SQL语句建表怎么建啊,自己写了第一个,为什么老显示字段定义语法错误???? 5
这是我自己写的第一个“产品信息”表,求助攻哪里错了??CREATETABLE产品信息(column1产品编号char(6)primartkey,column2产品名称Ch...
这是我自己写的第一个“产品信息”表,求助攻哪里错了??CREATE TABLE 产品信息(column1 产品编号 char(6) primart key,column2 产品名称 Char(30) not null,column3 价格 float(8) default(10.00),column4 库存量 Int default(0),column5 地址 Char(20));
展开
1个回答
展开全部
1.
CREATE TABLE [dbo].[产品信息](
[产品编号] [char](5) COLLATE Chinese_PRC_CI_AS NOT NULL,
[产品名称] [char](30) COLLATE Chinese_PRC_CI_AS NOT NULL,
[价格] [float] NULL CONSTRAINT [DF_产品信息_价格] DEFAULT ((10.00)),
[库存量] [int] NULL CONSTRAINT [DF_产品信息_库存量] DEFAULT ((0)),
[地址] [char](20) COLLATE Chinese_PRC_CI_AS NULL,
CONSTRAINT [PK_产品信息] PRIMARY KEY CLUSTERED
(
[产品编号] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
2.
CREATE TABLE [dbo].[销售信息](
[产品编号] [char](6) COLLATE Chinese_PRC_CI_AS NOT NULL,
[产品名称] [char](30) COLLATE Chinese_PRC_CI_AS NOT NULL,
[客户名称] [char](20) COLLATE Chinese_PRC_CI_AS NOT NULL,
[单价] [float] NULL CONSTRAINT [DF_销售信息_单价] DEFAULT ((10.00)),
[数量] [int] NULL CONSTRAINT [DF_销售信息_数量] DEFAULT ((0)),
[金额] [float] NULL CONSTRAINT [DF_销售信息_金额] DEFAULT ((0)),
CONSTRAINT [PK_销售信息] PRIMARY KEY CLUSTERED
(
[产品编号] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
3.
CREATE TABLE [dbo].[生产信息](
[部门编号] [char](6) COLLATE Chinese_PRC_CI_AS NOT NULL,
[负责人] [char](8) COLLATE Chinese_PRC_CI_AS NOT NULL,
[联系电话] [char](20) COLLATE Chinese_PRC_CI_AS NULL,
CONSTRAINT [PK_生产信息] PRIMARY KEY CLUSTERED
(
[部门编号] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[产品信息](
[产品编号] [char](5) COLLATE Chinese_PRC_CI_AS NOT NULL,
[产品名称] [char](30) COLLATE Chinese_PRC_CI_AS NOT NULL,
[价格] [float] NULL CONSTRAINT [DF_产品信息_价格] DEFAULT ((10.00)),
[库存量] [int] NULL CONSTRAINT [DF_产品信息_库存量] DEFAULT ((0)),
[地址] [char](20) COLLATE Chinese_PRC_CI_AS NULL,
CONSTRAINT [PK_产品信息] PRIMARY KEY CLUSTERED
(
[产品编号] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
2.
CREATE TABLE [dbo].[销售信息](
[产品编号] [char](6) COLLATE Chinese_PRC_CI_AS NOT NULL,
[产品名称] [char](30) COLLATE Chinese_PRC_CI_AS NOT NULL,
[客户名称] [char](20) COLLATE Chinese_PRC_CI_AS NOT NULL,
[单价] [float] NULL CONSTRAINT [DF_销售信息_单价] DEFAULT ((10.00)),
[数量] [int] NULL CONSTRAINT [DF_销售信息_数量] DEFAULT ((0)),
[金额] [float] NULL CONSTRAINT [DF_销售信息_金额] DEFAULT ((0)),
CONSTRAINT [PK_销售信息] PRIMARY KEY CLUSTERED
(
[产品编号] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
3.
CREATE TABLE [dbo].[生产信息](
[部门编号] [char](6) COLLATE Chinese_PRC_CI_AS NOT NULL,
[负责人] [char](8) COLLATE Chinese_PRC_CI_AS NOT NULL,
[联系电话] [char](20) COLLATE Chinese_PRC_CI_AS NULL,
CONSTRAINT [PK_生产信息] PRIMARY KEY CLUSTERED
(
[部门编号] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询