Ass2 It3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

ASSIGNMENT

#2
Academic Year 2020 – 2021 /Even Semester
(20202) Subject : Database System
Lecturer : R. B. Wahyu
Study Program : Information Technology
Class 3 Due date : May 8th 2021

Instructions to candidate:
1. This EXCERCISE paper consists of 10 pages and 3 questions.
2. You ARE NOT ALLOWED to copy the copy from your friends.
3. In all the answer you have to make different from MASTER and
TRANSACTION tables.

Name : HARIS ADI NUGROHO


Student ID : 001202000168
Questions:

1. Suppose you have been given the table structure and data shown in the following
figure, which was imported from an Excel spreadsheet. The data reflect that a
professor can have multiple advisees, can serve on multiple committees, and can edit
more than one journal.

a. Create the tables that conform to 3NF.


b. Draw the Crow’s Foot ERD to reflect the dependency and
relationship diagrams;
c. For all entities/tables created please write the MASTER and
TRANSACTION data accordingly!
d. Create the DATABASE for this schema then do the following
(Please print screen /the SQL STATEMENTS FOR all the
following activities):
1 of 10
i. For all entities please CREATE the tables;

2 of 10
ii. Insert the data into all tables (masters and transactions);
iii. List the employee number and name, student number,
names and academic year for every professor;
iv. List the employee number and name, committee code,
committee names and start date for every professor in
assigned in every committe;
v. List the employee number and name, journal code, journal
name and start date for every professor who are editors in
every journal.
a)3 NF

1 of 10
b)Crow’s foot ERD

C). For all entities/tables created please write the master and transaction data accordingly

2 of 10
1. Master Data:

EMP_NAME EMP_NUM PROF_RANK DEPT_CODE PROF_OFFICE


gilang 187 Professor CIS KL-567
rael 160 Asst. Professor CHEM BDV-200
jajang 109 Assoc. Professor CIS KVV-673
surya 132 Asst. Professor ENG PLE-456

i. employee

ii. Department

DEPT_CODE DEPT_NAME
CIS COMP. TECHNOLOGY
CHEM CHEMISTRY
ENG ENGLISH

iii. Student
STUDENT_NAME STUDENT_NUM
AKBAR 1324
BAGAS 2312
RAEL 3102
SURYA 2782
BAGUS 2134
SHELINE 2786
JONO 3456
AHMAD 2873
JAJANG 9866
BUDI 2085

3 of 10
iv. Committee

COMMITTEE_NAME COMMITTEE_CODE
PROMOTION PROMO
TRAFFIC TRAF
APPLICATION APP
DEVELOPMENT DEV
SUPERIOR SPR

JOURNAL_CODE JOURNAL_NAME
JMIS JOURNAL IN MANAGEMENT INFORMATION SYSTEMS
QED QUALITY IN EDUCATION
JMGT JOURNAL OF MANAGEMENT
JCIS JOURNAL IN COMPUTER INFORMATION SYSTEMS

4 of 10
2. Transaction Data:
i. Advisee

COMMITTEE_CODE EMP_NUM START_DATE


PROMO 134 1/2/2021
TRAF 135 1/2/2021
APP 136 1/2/2021
DEV 137 1/2/2021
DEV 116 1/2/2021
SPR 129 1/2/2021
TRAF 130 1/2/2021
PROMO 121 1/2/2021
SPR 122 1/2/2021
DEV 123 1/2/2021

JOURNAL_CODE EMP_NUM START_DATE


JMIS 123 1/2/2021
QED 123 1/2/2021
JMGT 123 1/2/2021
JCIS 118 1/2/2021
JMGT 118 1/2/2021

ii. Assignment

EMP_NUM STUDENT_NUM ACAD_YEAR


123 1324 2020-2021
123 2312 2020-2021
124 3232 2020-2021
124 2218 2020-2021
125 2098 2020-2021
125 3102 2021-2022
125 2782 2021-2022
126 3311 2021-2022
126 2008 2021-2022
127 7657 2021-2022

iii. Editor
5 of 10
6 of 10
D. Create the DATABASE for this schema then do the following
(Please print screen /the SQL STATEMENTS FOR all the
following activities):
vi. For all entities please CREATE the tables;

7 of 10
vii. Insert the data into all tables (masters and transactions);
Master Data

Employee

Student

8 of 10
Department

committee

9 of 10
Journal

Transactions Data

Advisee

10 of
10
Assignment

Editor

11 of
10
viii. List the employee number and name, student number,
names and academic year for every professor;

ix. List the employee number and name, committee code,


committee names and start date for every professor in
assigned in every committe;

12 of
10
x. List the employee number and name, journal code, journal
name and start date for every professor who are editors in
every journal.

13 of
10
a. ALL TABLES CONFORM TO 3NF

1. EMPLOYEE

EMP_NU EMP_NAM PROF_RA DEPT_CO PROF_OFFI


M E NK DE CE
PK FK

2. DEPARTMENT

DEPT_CO DEPT_NAM
DE E
PK

3. STUDENT

STUDENT_NU STUDENT_NAM
M E
PK

4. COMMITTEE

COMMITTEE_CO COMMITTEE_NA
DE ME
PK

14 of
10
5. JOURNAL

JOURNAL_CO JOURNAL_NA
DE ME
PK

6. ADVISEE

EMP_NUM STUDENT_NU ACAD_YEAR


M
P P P
K K K

7. ASSIGNMENT

COMMITTE_CO EMP_NUM START_DAT


DE E
PK P
K

8. EDITOR

JOURNAL_CO EMP_NUM START_DAT


DE E
PK PK

15 of
10
b. UNIVERSITY CROW’S FOOT ERD

4 of 10
c. MASTERS AND TRANSACTIONS DATA

MASTER DATA:

1. EMPLOYEE

EMP_NU EMP_NAM PROF_RANK DEPT_COD PROF_OFFI


M E E CE
123 GHEE Professor CIS KD-567
104 RANKIN Asst. Professor CHEM BLF-199
118 ORTEGA Assoc. CIS KDD-562
Professor
119 SMITH Assoc. ENG PRT-345
Professor

2. DEPARTMENT

DEPT_CO DEPT_NAME
DE
CIS COMPUTER INFOR.
SYSTEMS
CHEM CHEMISTRY
ENG ENGLISH

3. STUDENT

STUDENT_NU STUDENT_NAME
M
1215 GHEE STD1
2312 GHEE STD2
3232 GHEE STD3
2218 GHEE STD4
2098 GHEE STD5
3102 RANKIN STD1
2782 RANKIN STD2
3311 RANKIN STD3
2008 RANKIN STD4
2876 RANKIN STD5
2222 RANKIN STD6
3745 RANKIN STD7
1783 RANKIN STD8
2378 RANKIN STD9
2134 ORTEGA STD1
2786 ORTEGA STD2
3456 ORTEGA STD3
2002 ORTEGA STD4

5 of 10
2046 ORTEGA STD5
2018 ORTEGA STD6
1764 ORTEGA STD7

6 of 10
2873 SMITH STD1
2765 SMITH STD2
2238 SMITH STD3
2901 SMITH STD4
2308 SMITH STD5

4. COMMITTEE

COMMITTEE_CO COMMITTEE_NA
DE ME
PROMO PROMOTION
TRAF TRAFFIC
APPL APPLICATION
DEV DEVELOPMENT
SPR SUPERIOR

5. JOURNAL

JOURNAL_CO JOURNAL_NA
DE ME
JMIS JOURNAL IN MANAGEMENT INFORMATION
SYSTEMS
QED QUALITY IN EDUCATION
JMGT JOURNAL OF MANAGEMENT
JCIS JOURNAL IN COMPUTER INFORMATION
SYSTEMS

TRANSACTIONS/RELATIONAL DATA:

6. ADVISEE

EMP_NU STUDENT_NU ACAD_YEA


M M R
123 1215 2020-2021
123 2312 2020-2021
123 3232 2020-2021
123 2218 2020-2021
123 2098 2020-2021
125 1215 2021-2022
125 2312 2021-2022
125 3232 2021-2022
125 2218 2021-2022
125 2098 2021-2022
104 3102 2020-2021
104 2782 2020-2021
104 3311 2020-2021
7 of 10
104 2008 2020-2021
104 2876 2020-2021

8 of 10
104 2222 2020-2021
104 3745 2020-2021
104 1783 2020-2021
104 2378 2020-2021
118 2134 2020-2021
118 2786 2020-2021
118 3456 2020-2021
118 2002 2020-2021
118 2046 2020-2021
118 2018 2020-2021
118 1764 2020-2021
119 2873 2020-2021
119 2765 2020-2021
119 2238 2020-2021
119 2901 2020-2021
119 2308 2020-2021

7. ASSIGNMENT

COMMITTE_CO EMP_NU START_DAT


DE M E
PROMO 123 01/01/2021
TRAF 123 01/01/2021
APPL 123 01/01/2021
DEV 123 01/01/2021
DEV 104 01/01/2021
SPR 118 01/01/2021
TRAF 118 01/01/2021
PROMO 119 01/01/2021
SPR 119 01/01/2021
DEV 119 01/01/2021

8. EDITOR

JOURNAL_CO EMP_NU START_DAT


DE M E
JMIS 123 01/01/2021
QED 123 01/01/2021
JMGT 123 01/01/2021
JCIS 118 01/01/2021
JMGT 118 01/01/2021

9 of 10
2. All of you must be part of a family. So please design a database for a FAMILY
system that at leat has 5 entities/relationships which consist of activities and or
services that you familiy doing for the 5 entities please do the following. The
database should record the names of your greater family, their activities, and the
services that they received (for example your uncle go a gymnastic at least twice a
week or watch movies etc...).
a. Create all tables that conform to 3NF;
b. Draw a Crow’s Foot ERD for the database;
c. Writed own the Masters and Transactions tables. For every
transaction table, write down at least 10 (ten) tuples data and for 3
persons shows that they go to the same activities/services at least
twice!

a. TABLES CONFORM TO 3NF

1. CITIZEN

CITIZEN_I CITIZEN_NA POB_CITY_ DATE_OF_BIR GENDER_CO RELATIONS


D ME ID TH DE HIP
P FK FK
K

2. CITY

CITY_ID CITY_NAME
P
3. GENDER
K

GENDER_I GENDER
D P
K
4. ACTIVITY

ACTIVITY_I ACTIVITY_NAM DURATION


D E
P
K

5. SERVICE

SERVICE_I SERVICE_NA UNIT_PRICE


10 of 10
D ME
P
K

11 of 10
6. ACTIVITY_DETAILS

CITIZEN_ID ACTIVITY_ ACTIVITY_DA


ID TE
P PK P
K K

7. SERVICE_DETAILS

CITIZEN_ID SERVICE_ID SERVICE_D QUANTITY UNIT_PRICE


ATE
P P PK
K K

b. FAMILY ACTIVITIES AND SERVICES CROW’S FOOT ERD

c. Please insert data for the Masters and Transactions tables.

1. Masters:

a. Citizen

CITIZEN_ID CITIZEN_NAME CITY_ID DATE_OF_BIRTH GENDER_CODE RELATIONSHIP


1 AHMAD 12 23/03/1973 M FATHER
2 SISWATI 12 14/05/1973 F MOTHER

12 of 10
3 SALVA 17 28/01/2006 M SISTER
4 HAMKA 25 3/10/2003 M BROTHER
5 GITA 87 13/9/1993 F STEPSISTER
6 DIMAS 35 30/7/1995 M DISTANT BROTHER
7 AKBAR 67 12/02/2001 M STEPBROTHER
8 GOZI 87 2/6/2015 M DISTANT BROTHER

b. City

CITY_ID CITY_NAME
12 PATI
17 BEKASI
87 CIAMIS

c. Gender

GENDER_CODE GENDER
M MALE
F FEMALE

d. Activity

ACTIVITY_ID ACTIVITY_NAME DURATION(MINUTES)


1 EATING 30
2 WORK FROM HOME 120
3 PLAY VIDEO GAMES 100
4 TOILETING 15
5 LAUNDRYS 25
6 MORNING TEA 10

e. Service

SERVICE_ID SERVICE_NAME UNIT_PRICE


31 CAR WASH 100,000

13 of 10
32 HAIR CUTS 120,000
33 MASSAGE 150,000
34 SHIPING 350,000

2. Transactions:
a. Activity Details

CITIZEN_ID ACTIVITY_ID ACTIVITY_DATE


3 1 10/9/2021
2 2 10/9/2021
3 3 10/9/2021
4 4 10/9/2021
5 6 10/9/2021
6 2 10/9/2021
1 3 10/9/2021
2 5 10/9/2021
3 2 10/9/2021
6 3 10/9/2021
8 4 10/9/2021
1 6 10/9/2021
5 1 10/9/2021
7 2 10/9/2021
8 4 10/9/2021

b. Service Details

CITIZEN_ID SERVICE_ID SERVICE_DATE QUANTITY UNIT_PRICE


4 31 6/2/2021 1 100,000
6 32 6/2/2021 1 120,000
1 33 6/2/2021 1 150,000
3 33 6/2/2021 2 300,000
4 33 6/2/2021 3 450,000
5 32 6/2/2021 1 120,000
2 33 6/2/2021 1 150,000
4 34 6/2/2021 1 350,000
5 31 6/2/2021 2 200,000
6 32 6/2/2021 3 360,000
7 33 6/2/2021 1 150,000
8 34 6/2/2021 1 350,000
3 32 6/2/2021 2 240,000
3 33 6/2/2021 1 200,000
14 of 10
d. Create the DATABASE for this schema then do the following (Please print screen
/the SQL STATEMENTS FOR all the following activities):

i. For all entities please CREATE the tables;

ii. Insert the data into all tables (masters and transactions);

MASTER DATA
(GENDER)

ACTIVITY

SERVICE

15 of 10
iii. List citizen id, citizen name, activity id, activity name, activity date for every
activity occurs;
iv. List citizen id, citizen name, service id, service name, quantity, unit price,
sub_total for every service occurs;
v. Update (add/substract/divide/multiply) an attribute value (the attribute has
numerical/integer value) of 2 records and then List citizen id, citizen name,
service id, service name, quantity, unit price, sub_total for every service occurs;
vi. List citizen id, citizen name, service id, service name, quantity, unit price,
sub_total for every order that have more than one orders from the citizens.

3. All of you must be familiar with KOPERASI (CREDIT UNION) business activities and
environment. So please design database for a KOPERASI system that at least has 4 entities
16 of 10
involved and for the 4 entities please do the following:
a. Create all tables that conform to 3NF;

1. MEMBER

MEM_NUM MEM_NAME POS_ID SAVING_COD LOAN_CODE


E
PK FK FK
2. POSITION

POS_NAME POS_NAME
P
K

17 of 10
3. SAVING

SAVING_CODE SAVING_TOTAL
P
K

4. LOAN

LOAN_CODE LOAN_TOTA DATE


L
PK PK

b. Draw a Crow’s Foot ERD for the database;

18 of 10
c. Writed own the Masters and Transactions tables. For every transaction table,
write down at least 10 (ten) tuples data and for 3 MEMBERS shows that they
borrow the money at least twice!

MASTER DATA :
1. MEMBER

19 of 10
MEM_NUM MEM_NAME POS_ID SAVING_COD LOAN_CODE
E
1 ADEL PM 111 101
2 RAZIQ VPM 112 102
3 AFNI SECRE 113 103
4 ERVA VSECRE 114 104
5 HANA TREA 115 105
6 AISYAH VTREA 116 106
7 RERE MEM 117 107
8 ISAL MEM 118 108
9 FAUZAN MEM 119 109
10 SIKA MEM 120 110

2. POSITION

POS_ID POS_NAME
PM PROJECT MANAGER
VPM VICE PM
SECRE SECRETARY
VSECRE VICE SECRETARY
TREA TREASURER
VTREA VICE TREASURER
MEM MEMBER

TRANSACTION DATA:
3. SAVING

SAVING_CODE SAVING_TOTAL
111 100.000
113 500.000
115 500.000
117 350.000
120 200.000

4. LOAN

20 of 10
LOAN_CODE LOAN_TOTA DATE
L
102 150.000 03-05-2021
102 200.000 04-05-2021
104 100.000 03-05-2021
104 50.000 04-05-2021
106 70.000 03-05-2021
106 130.000 04-05-2021
108 120.000 05-05-2021

d. Create the DATABASE for this schema then do the following (Please print
screen
/the SQL STATEMENTS FOR all the following activities):
i. For all entities please CREATE the tables;

ii. Insert the data into all tables (masters and transactions);

iii. List member number, member name, amount borrow, the date of
borrow from all members;

iv. Update (add/substract/divide/multiply) an attribute value (the attribute


has numerical/integer value) of 2 records of amount borrow and then
List member number, member name, amount borrow, the date of
borrow from all members;

21 of 10
v. List member number, member name, payment amount, the date of
payment from all members.

Good luck

22 of 10

You might also like