Anda di halaman 1dari 3

MID SEMESTER EXAMINATION

Academic Year 2014 2015 / 1st Semester


Subject
: Database Management Systems
Lecturer
: Zain Saifullah
Study Program : Information Technology / Information
Systems
Date of Exam
: October 23rd, 2014
Instructions to Students
1. This examination consist of 3 pages, 2 topics (A and B) and 9 questions totally.
2. Time allowed for this examination is 2 (two) hours and 30 minutes
3. Sanctions will be given to those students who are not following the
examination rules
4. All answers to be written in answer sheet provided. The number to the
corresponding question must be written correctly
5. This is an openbook and open laptop examination.
6. Students are not allowed to use calculator
7. Students are not allowed to use any dictionary
8. Students need to turn-off any communication devices
9. Students are not allowed to use electronic devices or borrow any equipment,
etc. from fellow students, nor can they communicate each other while the
examination is going on
Questions:
A. (75%) The following information related to the Receipt (3 receipts) issued by a
Restaurant
Restaurant ABC Hotel DEF

First Receipt

Jl. A No. 1 Jakarta Phone. 021-8888888


Transaction no.:85
Date:15/10/2014

Desk no.:
DINE_IN

3 Avocado Prawn Coctail

37.500

2 Assorted Fresh Juices

25.000

1 Assorted Chilled Juices

12.500

Total
Service
Tax 11 %

75.500
0
8.305

Total after Tax


Discount

83.805
6.000

Total after Discount

77.805

MasterCard

Restaurant ABC Hotel DEF

Second Receipt

Jl. A No. 1 Jakarta Phone. 021-8888888


Transaction no.:86
Date:15/10/2014

Desk no.:
DELIVERY

3 Avocado Prawn Coctail

37.500

2 Assorted Fresh Juices

25.000

1 Assorted Chilled Juices

12.500

Total
Service
Tax 11 %

75.500
7.550
9.136

Total after Tax


Discount

92.186
0

Total after Discount

92.186

Cash

===========================================
Restaurant ABC Hotel DEF

Third Receipt

Jl. A No. 1 Jakarta Phone. 021-8888888


Transaction no.:87
Date:15/10/2014

Desk no.:
DINE_IN

2 Avocado Prawn Coctail

25.000

1 Assorted Fresh Juices

12.500

2 Assorted Chilled Juices

25.000

Total
Service
Tax 11 %

62.500
0
6.875

Total after Tax


Discount

69.375
0

Total after Discount

69.375

Cash

1.
2.
3.
4.
5.

Create the E-R (Entity Relationships Diagram) for the information


Determine the Primary Key, Foreign Key (if exists)
Write the SQL Statements which create database, table, and their attributes.
Insert the data
Create SQL statements that implements the questions below
a. The output is
Date
Type of Transaction Total Revenue
Total Revenue after
Discount
15/10/2014 DINE_IN
15/10/2014 DELIVERY

138.000
75.500

b. The output is
Date
# of Transaction
15/10/2014

147.180
92.186

Average of Total Revenue after Discount

79.789

c. The output is
Date
Type of Payment
15/10/2014
15/10/2014

Total Revenue after Discount

Cash
MasterCard

161.561
77.905

d. The output is
Sold Menu
Avocado Prawn Coctail
Assorted Fresh Juices
Assorted Chilled Juices

# Menu
8
5
4

B. (25%)
1. Find the equivalent type(s) in PostgreSQL and give brief explanation for:
a. varchar in SQL
b. int
c. date
2. How to create a table in database using PostgreSQL (Describe briefly)
3. Using
a.
b.
c.

PSQL, type the statement to:


List the databases
List the tables on current database
Describe a certain table

4. Entity Commodity consists of: commodity code, commodity name, commodity


classification; and Entity Country consists of: country name and capital city.
Each commodity can be traded to many country and each country can do
trading activities on many commodities.
Create another entity so there is no many to many relationships; and
determine Primary Key and Foreign Key (if exists) for all entities.