Database System SD2052                              Assignment

  1. A fully annotated E-R diagram 1 and 2 showing the entities, primary  and foreign keys, composite keys and relationships.

Entity Relationship Diagram

An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships between entities in a database. ER diagrams often use symbols to represent three different types of information. Boxes are commonly used to represent entities. Diamonds are normally used to represent relationships and ovals are used to represent attributes.

ER 1

ER 2


b)  A Relational schema of your database in 3NF, clearly indicating   attributes, the data type of each attribute, primary and foreign keys, candidate keys, and which attributes are nullable, giving reasons.  List any assumptions you need to make.

        Normalization (BCNF)

In the relational model of databases, a candidate key of a relation is a minimal superkey and also is a field that can be part of the primary key to uniquely identify a record for each entity can have more candidate keys but it’s not necessary to use them all as part of the primary key in figure 3.1.

        Relation

Key attribute (Ordinary or circle shape) is a key attribute that is the unique and distinguishing characteristic of the entity in diagram below.


DatabaseSchema

        3NF

Student (SID, SNAME, SADDRESS, SAGE, SEX, NATIONALITY, ROOM_TYPE)

Apartment (AID, ROOM_TYPE, PLACE_NO, ROOM_NO, COST)

Hall Of Residences (HID, ROOM_TYPE, PLACE_NUMBER, ROOM_NO, COST)

Lease (LID, SID, DURATION, PLACE_NO, ROOM_NO)

Assumptions

used for this scenario are as following

  • Student need to choose apartment or hall of residence
  • Student need information what room they stay and how long they stay with cost

c) Listings of the records in each table. There should be at least 10 records in each.

 SQL> select * from student;

  SID SNAME      SADDRESS          SAGE SEX    NATIONALITY ROOM

----- ---------- ----------------- ---- ------ ----------- -----------------

 1001 JH low     23 Taman Bangi      21 male   chinese     apartment

 1002 Khar Fai   28 Taman Kepong     20 male   chinese     apartment

 1003 Kenny Lee  8 Jalan Rawang      28 male   chinese     apartment

 1004 Eugune Yap 76 Taman Kepong     23 male   chinese     apartment

 1005 Sam Low    4 Taman Cheras      26 male   chinese     apartment

 1006 Suntheran  1 Taman Sentu       27 male   indian      apartment

 1007 Lloyd      6 Taman Sentosa     29 male   indian      apartment

 1008 Mohamad    9 Taman Rawang      26 male   indian      apartment

 1009 Alice Tew  88 Taman Rawang     20 female chinese     apartment

 1010 Lina Koh   27 Taman Puchong    19 female chinese     apartment

 1011 Mindy Aw   77 Taman Kuantan    21 female chinese     apartment

  SID SNAME      SADDRESS          SAGE SEX    NATIONALITY ROOM_TYPE

----- ---------- ----------------- ---- ------ ----------- -----------------

 1012 Karena Ng  32 Taman Selayang   24 female chinese     apartment

 1013 Chris Lee  3 Taman Genny       24 male   chinese     hall of residence

 1014 Alex Wong  12 Taman Istana     23 male   chinese     hall of residence

 1015 Chifford   9 Taman Bangsa      24 male   Indian      hall of residence

 1016 Jenny Khoo 22 Taman Imbi       24 female chinese     hall of residence

 1017 Ken Ng     4 Taman Bintang     23 male   chinese     hall of residence

 1018 Kogilar    38 Taman Bangsa     22 female indian      hall of residence

 1019 Jacky Tan  5 Taman Rawang      24 male   chinese     hall of residence

 1020 Sabrina    34 Taman Kepong     20 female indian      hall of residence

 1021 Ben Lee    5 Taman Genny       29 male   chinese     hall of residence

Join now!

 1022 Silva      29 Taman Imbi       29 male   Indian      hall of residence

22 rows selected.


SQL> select * from apartment;

AID ROOM_TYPE     PLACE_NO ROOM_NO cost

--- ------------- -------- ------- ------

A1  A-Group by3   A-01     101-3   RM 150

A2  A-Group by4   A-01     101-4   RM 130

A3  A-Group by5   A-01     101-5   RM 100

A4  A-Group by3   A-02     201-3   RM 150

A5  A-Group by4   A-02     201-4   RM 130

A6  A-Group by5 ...

This is a preview of the whole essay