📄 设备管理系统.sql
字号:
--创建设备信息表
create table device_info_tab
(device_code varchar2(24) not null ,
device_name varchar(24) not null,
description varchar(1000) null,
oper_date date not null,
buyer varchar2(24) null,
lend_status integer null
check(lend_status in(0,1)),
lend_id integer null);
--添加设备编号主键
alter table device_info_tab
add(primary key(device_code));
--创建设备借出信息表
create table device_lend_info_tab
(lend_id integer not null,
device_code varchar2(24) not null,
borrower varchar(24) not null,
borrow_date date null,
return_date date null
);
--添加借出id主键
alter table device_lend_info_tab
add (primary key (lend_id));
--添加设备编号外键
alter table device_lend_info_tab
add(foreign key(device_code) references device_info_tab);
--创建可以递增的序列号供lend_id使用
create sequence seq_lend_id increment by 1 start with 1
nomaxvalue nominvalue nocycle;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -