系统设计与数据库原理 作业四 Data Modelling using PowerDesigner

简介: 系统设计与数据库原理 作业四 Data Modelling using PowerDesigner

Purpose of Experiment purpose and Requirements


Transform the following ER diagram into Relations and Create the required tables using Oracle / MySQL: (with Primary Key, Foreign Key if any, Data types, Width, Domain and Integrity Constraints )


Identify the following

1) Identify the type of relationship (1:1, 1:m, m:m)

2) Identify the cardinality (Min, Max)

3) Primary Key


EER diagram 1):

7938d8b03f6b42e090e7e51f8f0e63c2.png



①Employee → Mechanic 1:m

②Employee → Salesman 1:m

③Mechanic → RepairJob 1:m

④RepairJob → Cars m:1

⑤ Salesman → Clients 1:m

⑥ Salesman → Cars 1:m


①Mechanic does RepairJob is (0,m)

②RepairJob repairs is (1,m)

③Cars is repaired by RepairJob is (0,1)

④Salesman buys is (0,m)

⑤Clients buys is (0,m)

⑥Clients sells is (0,m)

⑦Client (0,m)


The underlined one is primary key

①Mechanic (MNumber,MName)

②RepairJob (Description, RepairNumber,MNumber,License,Cost)

③RepairCost (RepairNumber,MNumber,License,Parts,Work)

④Car (License,Manufacturer,Model,Year);

⑤Salesman (SNumber,SName);

⑥Client (CID,CName,Address);

⑦ClicentPhone (CID,Phone);

⑧Buys(SNumber,CID,License,Price,Date,Value);

⑨Sells(SNumber,CID,License,Date,Value,Commission);


I use the following MySQL code to establish these tables:


CREATE TABLE `Mechanic` (
    `MNumber` INT(4) NOT NULL PRIMARY KEY,
    `Name` VARCHAR(20) NOT NULL
);
CREATE TABLE `Salesman` (
    `SNumber` INT(4) NOT NULL PRIMARY KEY,
    `Name` VARCHAR(20) NOT NULL
);
CREATE TABLE `RepairJob` (
    `RepairNumber` INT(4) NOT NULL PRIMARY KEY,
    `MNumber` INT(4),
    FOREIGN KEY (MNumber)
        REFERENCES Mechanic (MNumber),
    `License` VARCHAR(20),
    FOREIGN KEY (License)
        REFERENCES car (License),
    `Description` VARCHAR(20) NOT NULL,
    `Parts` VARCHAR(20) NOT NULL,
    `Work` VARCHAR(20) NOT NULL
);
CREATE TABLE `Client` (
    `ID` INT(4) NOT NULL PRIMARY KEY,
    `Phone` INT(11) NOT NULL,
    `Address` VARCHAR(20) NOT NULL,
    `Name` VARCHAR(20) NOT NULL
);
CREATE TABLE `Phone` (
    `ID` INT(4),
    FOREIGN KEY (ID)
        REFERENCES Client (ID),
    `Phone` INT(11) NOT NULL
);
CREATE TABLE `Car` (
    `License` VARCHAR(20) NOT NULL PRIMARY KEY,
    `SNumber` INT(4),
    FOREIGN KEY (SNumber)
        REFERENCES Salesman (SNumber),
    `ID` INT(4),
    FOREIGN KEY (ID)
        REFERENCES Client (ID),
    `Manufacturer` VARCHAR(10) NOT NULL,
    `Model` VARCHAR(10) NOT NULL,
    `Year` DATE NOT NULL
);
CREATE TABLE `Buys` (
    `SNumber` INT(4),
    FOREIGN KEY (SNumber)
        REFERENCES Salesman (SNumber),
    `License` VARCHAR(20) NOT NULL,
    FOREIGN KEY (License)
        REFERENCES Car (License),
    `ID` INT(4) NOT NULL,
    FOREIGN KEY (ID)
        REFERENCES Client (ID),
    `Price` INT(10) NOT NULL,
    `Date` DATE NOT NULL,
    `Value` INT(10) NOT NULL
);
CREATE TABLE `Buys` (
    `SNumber` INT(4),
    FOREIGN KEY (SNumber)
        REFERENCES Salesman (SNumber),
    `License` VARCHAR(20) NOT NULL,
    FOREIGN KEY (License)
        REFERENCES Car (License),
    `ID` INT(4) NOT NULL,
    FOREIGN KEY (ID)
        REFERENCES Client (ID),
    `Commission` INT(10) NOT NULL,
    `Date` DATE NOT NULL,
    `Value` INT(10) NOT NULL
);


Case Study


A relational database is to be designed for a medium sized Company dealing with developing application software. The Company delivers various products to its customers ranging from a single application program to customized software. The Company employs various experts, consultants and supporting staff. All personnel are employed on long-term basis, i.e. there are no short-term or temporary staffs.


Although the Company is somehow structured for administrative purposes (that is, it is divided into departments headed by department managers) all projects are carried out in an inter-disciplinary way. For each project has a Start date when a project team is selected, grouping employees from different departments, and a Project Manager (also an employee of the Company) is appointed who is entirely and exclusively responsible for the control of the project, quite independently of the Company’s hierarchy. The following is a brief statement of some facts and policies adopted by the Company.


Entities

• Department

• Employee

• Skills

• Team

• Customers

• Product

• Projects

• Spouse

• Dependent(children of employee)


Relationships

• Employees work for different department headed by a Manager

• Employee has Spouse and Dependent (child)

• Each department manages many employees.

• Employees are divided into many teams

• Each Team manages a project

• Each Department is Headed by a Department Manager

• Each Employees belongs to one team

• A Project is headed by Project Team

• Skills are used in projects


Draw the Logical Data Model and Physical Data Model for Oracle DBMS using Power Designer


Logical Data Model


2ebdd2df2e28457db9f050e576581735.png


Physical Data Model:


eca4bc8c6fa243b6bd2f96da61b1166a.png

相关文章
|
14天前
|
存储 关系型数据库 MySQL
MySQL数据库进阶第六篇(InnoDB引擎架构,事务原理,MVCC)
MySQL数据库进阶第六篇(InnoDB引擎架构,事务原理,MVCC)
|
13天前
|
SQL 存储 关系型数据库
数据库的基本原理
数据库的基本原理
15 2
|
17天前
|
SQL 存储 多模数据库
数据库技术探索:原理、应用与未来发展趋势
一、引言 数据库技术作为信息时代的基石,已经深入到社会的各个角落
|
17天前
|
存储 SQL Cloud Native
数据库技术揭秘:核心原理与前沿实践
一、引言 数据库技术是信息化时代的基石,它为我们提供了一种高效、可靠的方式来存储、检索和管理数据
|
3天前
|
SQL Java 数据库
使用Spring Boot和Spring Data JPA进行数据库操作
使用Spring Boot和Spring Data JPA进行数据库操作
|
5天前
|
存储 NoSQL 关系型数据库
数据库系统原理:从基础到实践的探索
数据库系统原理:从基础到实践的探索
|
8天前
|
SQL Java 关系型数据库
Java与数据库连接技术JDBC关键核心之PreparedStatement以及SQL注入演示解决和原理
Java与数据库连接技术JDBC关键核心之PreparedStatement以及SQL注入演示解决和原理
12 0
|
11天前
|
关系型数据库 MySQL 数据库
MySQL数据库作业设计之豆瓣音乐
MySQL数据库作业设计之豆瓣音乐
15 0
|
12天前
|
关系型数据库 MySQL 项目管理
数据库大作业——基于qt开发的图书管理系统(四)项目目录的整理与绘制登录页面
数据库大作业——基于qt开发的图书管理系统(四)项目目录的整理与绘制登录页面
|
12天前
|
SQL 关系型数据库 MySQL
数据库大作业——基于qt开发的图书管理系统(三)Qt连接Mysql数据库
数据库大作业——基于qt开发的图书管理系统(三)Qt连接Mysql数据库