Home >Database >Mysql Tutorial >Mysql创建通用设备管理信息系统数据库_MySQL

Mysql创建通用设备管理信息系统数据库_MySQL

PHP中文网
PHP中文网Original
2016-05-27 10:44:131827browse

下面通过图文并茂的方式给大家介绍通用设备管理信息系统数据库的创建过程,具体详情请看下文。

设备表:id,名称,类别,型号,投运日期,购入日期,制造单位,数量,计量单位,使用部门,安装
地点,产品图片,技术数据,备注;

缺陷表:id, 设备id,缺陷描述,处理情况,处理人员;

事故表:id,设备id,事故描述,处理情况,处理人员;

维修类别表:id,类别名称,维修内容,周期(天)

设备类别表:id,类别名称;

部门表:id,部门名称;

设备状态表:id,状态名称

设备状态: 指定设备的状态,其状态数据有:上线、封存、闲置、报废、待修、备用

维修人员表:id,姓名,部门,职务,职称;

备品备件表:id,名称,数量,计量单位,用途,现有库存量,最低库存量;

工具表:id,名称,数量,计量单位,用途;

维修记录表:id,维修类别id,设备id,维修人员,维修情况,维修时间,所耗物料;

设备巡检表:id,设备id,检查日期,检查人员,检查情况,检查方式;

create database devmng; 
show databases;

create table Equipment 
( 
equipmentID int not null auto_increment, 
devtypeID int, 
devname varchar(50), 
modnum varchar(50), 
touyundate date, 
gourudate date, 
zhidaodw varchar(100), 
quantity int, 
unit varchar(8), 
useDepartment varchar(50), 
storePlace varchar(80), 
picture varchar(256), 
technicalData varchar(256), 
remark varchar(256), 
primary key (equipmentID) 
);

create table devbug 
( 
bugID int not null auto_increment, 
devid int, 
bugcontent varchar(256), 
chuliqk varchar(100), 
chuliren varchar(80), 
primary key (bugID) 
); 
create table devfault 
( 
faultID int not null auto_increment, 
devid int, 
faultcontent varchar(256), 
chuliqk varchar(100), 
chuliren varchar(80), 
primary key (faultID) 
);

create table repairtype 
( 
rtID int not null auto_increment, 
rtname varchar(24), 
rtcontent varchar(256), 
cycle int, 
primary key (rtID) 
); 
create table devtype 
( 
dtID int not null auto_increment, 
dtname varchar(36), 
primary key (dtID) 
); 
create table part 
( 
ptID int not null auto_increment, 
partname varchar(36), 
primary key (ptID) 
);

create table devstatus 
( 
dsID int not null auto_increment, 
dsname varchar(12), 
primary key (dsID) 
); 
insert into devstatus values (1,"上线"); 
insert into devstatus values (2,"封存"); 
insert into devstatus values (3,"闲置"); 
insert into devstatus values (4,"报废"); 
insert into devstatus values (5,"待修"); 
insert into devstatus values (6,"备用");

create table repairpl 
( 
rpID int not null auto_increment, 
ptid int, 
rpname varchar(24), 
zhiwu varchar(36), 
zhich varchar(36), 
primary key (rpID) 
); 
create table bpbj 
( 
bbID int not null auto_increment, 
bbname varchar(36), 
num int, 
unit varchar(8), 
purpose varchar(256), 
xianyounum int, 
minnum int, 
primary key (bbID) 
);

注意:use是关键字;不能用作字段名;

create table tools 
( 
tID int not null auto_increment, 
tname varchar(36), 
num int, 
unit varchar(8), 
purpose varchar(256), 
primary key (tID) 
); 
create table rprecords 
( 
rrID int not null auto_increment, 
rtID int, 
equipmentID int, 
rpren varchar(100), 
rpcontent varchar(300), 
rpdate date, 
wuliao varchar(150), 
primary key (rrID) 
);

create table checkrecords 
( 
crID int not null auto_increment, 
equipmentID int, 
checkdate date, 
checkren varchar(80), 
checkcontent varchar(100), 
checktype varchar(36), 
primary key (crID) 
); 
ALTER TABLE Equipment ADD statusID int;

为设备表增加一个设备状态列;

数据库资源下载

http://pan.baidu.com/s/1bpnx1YR

以上内容是针对Mysql创建通用设备管理信息系统数据库的全部内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn