在智慧社区商超管理系统中,通常有多种不同角色的人员使用该系统,超市里面有各种各样不同的商品,商品都有不同的供应商。
.1、根据上述语义画出ER图。
.2、将ER模型转换成数据表,并指出每个数据表的主键。
收银员数据表
名称 类型 备注 是否为空
Id 工号 Int 主键,否
Name 姓名 Varchar(15) 否
Password 密码 Varchar(15) 否
Tel 电话 Int 否
商品数据表
名称 类型 备注 是否为空
Id 商品号 Int 主键,否
Name 商品名称 Varchar(20) 否
Price 单价 Int 是
库管员数据表
名称 类型 备注 是否为空
Id 工号 Int 主键,否
Name 姓名 Varchar(15) 否
Password 密码 Varchar(15) 否
Tel 电话 Int 否
供应商数据表
名称 类型 备注 是否为空
Name 供应商名 Varchar(50)主键,否
Label 代码 Varchar(50) 是
Time 时间 Varchar(20) 是
Contacts 联系人 Varchar(15) 否
Tel 电话 Int 是
商超系统数据表
名称 备注 是否为空
Cashier 收银员 否
Commodity 商品 否
Administrator 库管员 否
Suoolier 供应商 否
USE [tdc2017270371]
GO
/****** Object: Table [dbo].[销售表] Script Date: 11/04/2018 16:09:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[销售表](
[id] [varchar](10) NOT NULL,
[xssl] [int] NULL,
[time] [datetime] NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[收银员] Script Date: 11/04/2018 16:09:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[收银员](
[id] [varchar](10) NOT NULL,
[name] [varchar](10) NULL,
[xb] [varchar](10) NULL,
[mm] [varchar](10) NULL,
[tel] [varchar](15) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[商品] Script Date: 11/04/2018 16:09:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[商品](
[spid] [varchar](20) NOT NULL,
[spname] [varchar](20) NULL,
[spprice] [float] NULL,
[scrq] [datetime] NULL,
[sccj] [varchar](20) NULL,
PRIMARY KEY CLUSTERED
(
[spid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[录入表] Script Date: 11/04/2018 16:09:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[录入表](
[id] [varchar](10) NOT NULL,
[spsl] [int] NULL,
[time] [datetime] NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[管理员] Script Date: 11/04/2018 16:09:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[管理员](
[id] [varchar](10) NOT NULL,
[name] [varchar](10) NULL,
[xb] [varchar](10) NULL,
[mm] [varchar](10) NULL,
[tel] [varchar](15) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[供货商] Script Date: 11/04/2018 16:09:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[供货商](
[id] [varchar](10) NOT NULL,
[label] [varchar](10) NOT NULL,
[spname] [varchar](10) NULL,
[lxr] [varchar](10) NULL,
[tel] [varchar](10) NULL,
PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO