Professional Documents
Culture Documents
ĐẠI HỌC KHOA HỌC TỰ NHIÊN THÀNH PHỐ HỒ CHÍ MINH, ĐẠI HỌC QUỐC GIA TP HCM
Mã nhóm: 20
Tên
nhóm: Nhóm 20
Số lượng: 4
Điện
MSSV Họ tên Email Hình ảnh
thoại
20120527 Trần Ngọc Long 20120527@student.hcmus.edu.vn
18120564 Lâm Hồng Thành 18120564@student.hcmus.edu.vn
20120044 Ngô Thị Ngọc Bội 20120044@student.hcmus.edu.vn
20120542 Trịnh Thị Tuyết Nhung 20120542@student.hcmus.edu.vn
Bảng phân công & đánh giá hoàn thành công việc
Mức độ hoàn Đánh giá
Công việc thực hiện Người thực hiện
thành của nhóm
Tìm hiểu chuyên sâu thiết kế trong công cụ. Lâm Hồng Thành 100% 10/10
Viết mô tả cơ sở dữ liệu và phát sinh mô
hình dữ liệu quan hệ mức vật lý
Từ mô hình dữ liệu mức vật lý, vẽ lại bằng Ngô Thị Ngọc Bội 100% 10/10
công cụ PowerDesigner.
Mô hình hóa cơ sở dữ liệu thông qua mô Trịnh Thị Tuyết Nhung 100% 10/10
hình mức quan niệm và viết bài báo cáo.
Tìm hiểu cách kết nối và phát sinh dữ liệu Trần Ngọc Long 100% 10/10
và dựng video
• Mô hình hóa mô hình dữ liệu quan niệm (ERD, E-ERD) mức quan niệm.
• Chuyển mô hình quan niệm sang mức vật lý (physical).
• Kết nối công cụ & DBMS, và phát sinh dữ liệu sang DBMS (DBMS chọn
cho bài tập là MS SQL Server).
B. Bài làm
• Thiết kế Conceptual Data model (CDM) bằng sơ đồ thực thể kết hợp
• Có thể phát sinh Physical Data Model (PDM) tương ứng trên một DBMS
được chọn.
• Có thể phát sinh ràng buột toàn vẹn tham chiếu (referential integrity
triggers) nếu chúng được hổ trợ bởi CSDL đích.
• Cho phép hiệu chỉnh và in các model.
- PowerDesigner được sử dụng với mục đích phát sinh dữ liệu tự động cho cơ sở
dữ liệu. Chương trình cho phép người dùng phát sinh code tự động với các
template có thể tùy chỉnh được như: SQL, Java, .NET,…
- PowerDesigner cho phép doanh nghiệp hình dung, phân tích và thao tác siêu dữ
liệu để tạo ra kiến trúc thông tin hoạt động hiệu quả. Phần mềm hỗ trợ đắc lực
trong việc thiết kế mô hình quan hệ, mô hình CDM, PDM, ERD, ER, …
PHONGBAN(MAPB, TENPB)
THANNHAN(TENTN, NGSINH,DIACHI)
BUSINESS RULE:
Một nhân viên chỉ làm việc duy nhất cho một phòng ban và một phòng ban có ít nhất
một nhân viên.
Một nhân viên có thể tham gia nhiều đề án và một đề án có thể có nhiều nhân viên.
Một nhân viên có thể có nhiều thân nhân và một thân nhân chỉ thuộc về một nhân viên.
Chúng em sẽ sử dụng bài toán này để thực hành thiết kế cơ sở dữ liệu rồi sau đó kết
nối dữ liệu với DBMS.
Thông qua công cụ PowerDesigner, nhóm chúng em đã đưa ra những thiết kế như
sau.
Bước 1: Vào File → New Model → Conceptual Diagram với Model name là QLNV
Bước 1: Vào Tools chọn Generate Physical Data Model (hoặc Ctrl+Shilf+P)
Bước 2: Chọn đường dẫn, trong khung file name đặt tên cho file là: QLNV.sql
Bước 5: Chọn mục Preview, ta có thể lấy được script tạo database.
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('NHANVIEN') and o.name = 'FK_NHANVIEN_LAMVIEC_PHONGBAN')
alter table NHANVIEN
drop constraint FK_NHANVIEN_LAMVIEC_PHONGBAN
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('THAMGIA') and o.name = 'FK_THAMGIA_THAMGIA_DEAN')
alter table THAMGIA
drop constraint FK_THAMGIA_THAMGIA_DEAN
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('THAMGIA') and o.name = 'FK_THAMGIA_THAMGIA2_NHANVIEN')
alter table THAMGIA
drop constraint FK_THAMGIA_THAMGIA2_NHANVIEN
go
if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('THANNHAN') and o.name = 'FK_THANNHAN_CO_NHANVIEN')
alter table THANNHAN
drop constraint FK_THANNHAN_CO_NHANVIEN
go
if exists (select 1
from sysindexes
where id = object_id('DEAN')
and name = 'CHUTRI_FK'
and indid > 0
and indid < 255)
drop index DEAN.CHUTRI_FK
go
if exists (select 1
from sysobjects
where id = object_id('DEAN')
and type = 'U')
drop table DEAN
go
if exists (select 1
from sysindexes
where id = object_id('NHANVIEN')
and name = 'LAMVIEC_FK'
if exists (select 1
from sysobjects
where id = object_id('NHANVIEN')
and type = 'U')
drop table NHANVIEN
go
if exists (select 1
from sysobjects
where id = object_id('PHONGBAN')
and type = 'U')
drop table PHONGBAN
go
if exists (select 1
from sysindexes
where id = object_id('THAMGIA')
and name = 'THAMGIA2_FK'
and indid > 0
and indid < 255)
drop index THAMGIA.THAMGIA2_FK
go
if exists (select 1
from sysindexes
where id = object_id('THAMGIA')
and name = 'THAMGIA_FK'
and indid > 0
and indid < 255)
drop index THAMGIA.THAMGIA_FK
go
if exists (select 1
from sysobjects
where id = object_id('THAMGIA')
and type = 'U')
drop table THAMGIA
go
if exists (select 1
from sysobjects
where id = object_id('THANNHAN')
and type = 'U')
drop table THANNHAN
go
/*==============================================================*/
/* Table: DEAN */
/*==============================================================*/
create table DEAN (
MADA varchar(10) not null,
MAPB varchar(10) not null,
/*==============================================================*/
/* Index: CHUTRI_FK */
/*==============================================================*/
create index CHUTRI_FK on DEAN (
MAPB ASC
)
go
/*==============================================================*/
/* Table: NHANVIEN */
/*==============================================================*/
create table NHANVIEN (
MANV varchar(10) not null,
MAPB varchar(10) not null,
TENNV varchar(30) null,
PHAI varchar(5) null,
LUONG money null,
constraint PK_NHANVIEN primary key nonclustered (MANV)
)
go
/*==============================================================*/
/* Index: LAMVIEC_FK */
/*==============================================================*/
create index LAMVIEC_FK on NHANVIEN (
MAPB ASC
)
go
/*==============================================================*/
/* Table: PHONGBAN */
/*==============================================================*/
create table PHONGBAN (
MAPB varchar(10) not null,
TENPB varchar(30) null,
constraint PK_PHONGBAN primary key nonclustered (MAPB)
)
go
/*==============================================================*/
/* Table: THAMGIA */
/*==============================================================*/
create table THAMGIA (
MADA varchar(10) not null,
MANV varchar(10) not null,
constraint PK_THAMGIA primary key (MADA, MANV)
)
go
/*==============================================================*/
/* Index: THAMGIA_FK */
/*==============================================================*/
/* Index: THAMGIA2_FK */
/*==============================================================*/
create index THAMGIA2_FK on THAMGIA (
MANV ASC
)
go
/*==============================================================*/
/* Table: THANNHAN */
/*==============================================================*/
create table THANNHAN (
MANV varchar(10) not null,
TENTN varchar(30) null,
NGSINH datetime null,
DIACHI varchar(100) null,
constraint PK_THANNHAN primary key (MANV)
)
go