Website: [You must be registered and logged in to see this link.] Trường Cao Đẳng Kinh Tế Tài Chính Vĩnh Long.
Mô hình ERD:
Mô hình vật lý:
Được sửa bởi luuthanhvan ngày Wed Oct 12, 2011 5:03 pm; sửa lần 1.
Mô hình ERD:
Mô hình vật lý:
Code:
drop table if exists BAIVIET;
drop table if exists BOMON;
drop table if exists HE_DAO_TAO;
drop table if exists KHOA;
drop table if exists KHOABOMON;
drop table if exists NGHANH;
drop table if exists PHANLOAI;
drop table if exists PHANLOAIBAIVIET;
drop table if exists THANHVIEN;
drop table if exists THUOC_VE;
drop table if exists TOCHUCCHINHTRIXAHOI;
/*==============================================================*/
/* Table: BAIVIET */
/*==============================================================*/
create table BAIVIET
(
MABAIVIET varchar(10) not null,
MAPLBV varchar(10) not null,
MATV varchar(10) not null,
TENBAIVIET nvarchar(max),
primary key (MABAIVIET)
);
/*==============================================================*/
/* Table: BOMON */
/*==============================================================*/
create table BOMON
(
MABM varchar(10) not null,
TENBM nvarchar(max),
primary key (MABM)
);
/*==============================================================*/
/* Table: HE_DAO_TAO */
/*==============================================================*/
create table HE_DAO_TAO
(
MAHE varchar(10) not null,
TENHE nvarchar(max),
primary key (MAHE)
);
/*==============================================================*/
/* Table: KHOA */
/*==============================================================*/
create table KHOA
(
MAKHOA varchar(10) not null,
TENKHOA nvarchar(max),
primary key (MAKHOA)
);
/*==============================================================*/
/* Table: KHOABOMON */
/*==============================================================*/
create table KHOABOMON
(
MAKHOA varchar(10) not null,
MABM varchar(10) not null,
primary key (MAKHOA, MABM)
);
/*==============================================================*/
/* Table: NGHANH */
/*==============================================================*/
create table NGHANH
(
MANGHANH varchar(10) not null,
MAKHOA varchar(10) not null,
TENNGANH nvarchar(max),
primary key (MANGHANH)
);
/*==============================================================*/
/* Table: PHANLOAI */
/*==============================================================*/
create table PHANLOAI
(
MALOAI varchar(10) not null,
TENLOAI nvarchar(max),
primary key (MALOAI)
);
/*==============================================================*/
/* Table: PHANLOAIBAIVIET */
/*==============================================================*/
create table PHANLOAIBAIVIET
(
MAPLBV varchar(10) not null,
TENPLBV nvarchar(max),
primary key (MAPLBV)
);
/*==============================================================*/
/* Table: THANHVIEN */
/*==============================================================*/
create table THANHVIEN
(
MATV varchar(10) not null,
MALOAI varchar(10) not null,
MAHE varchar(10) not null,
MATCCTXH varchar(10) not null,
HOTEN nvarchar(max),
NGAYSINH datetime,
DIACHI nvarchar(max),
GIOITINH varchar(3),
SODIENTHOAI varchar(11),
primary key (MATV)
);
/*==============================================================*/
/* Table: THUOC_VE */
/*==============================================================*/
create table THUOC_VE
(
MAKHOA varchar(10) not null,
MATV varchar(10) not null,
primary key (MAKHOA, MATV)
);
/*==============================================================*/
/* Table: TOCHUCCHINHTRIXAHOI */
/*==============================================================*/
create table TOCHUCCHINHTRIXAHOI
(
MATCCTXH varchar(10) not null,
TENTCCTXH nvarchar(max),
primary key (MATCCTXH)
);
alter table BAIVIET add constraint FK_DUOC_PHAN_LOAI foreign key (MAPLBV)
references PHANLOAIBAIVIET (MAPLBV) on delete restrict on update restrict;
alter table BAIVIET add constraint FK_DUOC_VIET foreign key (MATV)
references THANHVIEN (MATV) on delete restrict on update restrict;
alter table KHOABOMON add constraint FK_KHOABOMON foreign key (MAKHOA)
references KHOA (MAKHOA) on delete restrict on update restrict;
alter table KHOABOMON add constraint FK_KHOABOMON2 foreign key (MABM)
references BOMON (MABM) on delete restrict on update restrict;
alter table NGHANH add constraint FK_RELATIONSHIP_3 foreign key (MAKHOA)
references KHOA (MAKHOA) on delete restrict on update restrict;
alter table THANHVIEN add constraint FK_LA_THANH_VIEN foreign key (MATCCTXH)
references TOCHUCCHINHTRIXAHOI (MATCCTXH) on delete restrict on update restrict;
alter table THANHVIEN add constraint FK_RELATIONSHIP_1 foreign key (MALOAI)
references PHANLOAI (MALOAI) on delete restrict on update restrict;
alter table THANHVIEN add constraint FK_RELATIONSHIP_4 foreign key (MAHE)
references HE_DAO_TAO (MAHE) on delete restrict on update restrict;
alter table THUOC_VE add constraint FK_THUOC_VE foreign key (MAKHOA)
references KHOA (MAKHOA) on delete restrict on update restrict;
alter table THUOC_VE add constraint FK_THUOC_VE2 foreign key (MATV)
references THANHVIEN (MATV) on delete restrict on update restrict;
Được sửa bởi luuthanhvan ngày Wed Oct 12, 2011 5:03 pm; sửa lần 1.