Beruflich Dokumente
Kultur Dokumente
5.12 - Consider the AIRLINE relational database schema shown in Figure 5.8, which describes a database for airline flight information. Each FLIGHT is identified by a flight NUMBER, and consists of one or more FLIGHT_LEGS with LEG_NUMBERS 1, 2, 3, and so on. Each leg has scheduled arrival and departure times and airports and has many LEG_INSTANCES-one for each DATE on which the flight travels. FARES are kept for each flight. For each leg instance, SEAT_RESERVATIONS are kept, as are the AIRPLANE used on the leg and the actual arrival and departure times and airports. An AIRPLANE is identified by an AIRPLANE_ID and is of a particular AIRPLANE_TYPE. CAN_LAND relates AIRPLANE_TYPES to the AIRPORTS in which they can land. An AIRPORT is identified by an AIRPORT_CODE. Consider an update for the AIRLINE database to enter a reservation on a particular flight or flight leg on a given date. a. Give the operations for this update. b. What types of constraints would you expect to check? c. Which of these constraints are key, entity integrity, and referential integrity constraints, and which are not? d. Specify all the referential integrity constraints that hold on the schema shown in Figure 5.8.
Jawaban: a. b. Yang akan saya cek adalah key constraintnya (cek super key-nya), selanjutnya adalah Entity integrity constraintnya (cek kondisi primary key dari masing-masing tabel dan tidak boleh NULL) dan terakhir adalah mengecek referential integrity constraintnya (foreign key harus mereference ke primary key table yang di-reference) c. - Key & Entity Integrity Constraints: Airport_code pada tabel Airport. Flight_number pada table Flight. Airplane_type_name pada tabel Airplane_type. Aiplane_id pada tabel Airplane. Airplane_type_name+Airport_code pada tabel Can_land. Flight_number+Fare_code pada tabel Fare. Flight_number+Leg_number pada tabel Filght_leg. Flight_number+Leg_number+Date pada tabel Leg_instance. Flight_number+Leg_number+Date+Seat_number pada tabel Seat_reservation.
- Referential Integrity Constraints: Flight_number pada tabel Flight_leg me-reference ke Flight_number pada tabel Flight. Departure_airport_code & Arrival_airport_code pada tabel Flight_leg me-reference ke Airport_code pada tabel Airport. Flight_number pada tabel Leg_instance me-reference ke Flight_number pada tabel Flight. Departure_airport_code & Arrival_airport_code pada tabel Leg_instance me-reference ke Airport_code pada tabel Airport. Airplane_id pada tabel Leg_instance me-reference ke Airplane_id pada tabel Airplane. Flight_number pada tabel Fare me-reference ke Flight_number pada tabel Flight. Airplane_type_name pada tabel Can_land me-reference ke Airplane_type_name pada tabel Airplane_type. Airport_code pada tabel Can_land me-reference ke Airport_code pada tabel Airport. Airplane_type pada tabel Airplane me-reference ke Airplane_type_name pada tabel Airplane_type. Flight_number pada tabel Seat_reservation me-reference ke Flight_number pada tabel Flight. d.
AIRPORT
Airport_code Name City State
FLIGHT
Flight_number Airline Weekdays
FLIGHT_LEG
Flight_number Leg_number Departure_ airport_code Scheduled_ Departure_time Arrival_ Airport_code Scheduled_ Arrival_time
LEG_INSTANCE
Flight_number Leg_number Date Number_of_ Airplane_id Available_seats Departure_ Airport_code Departure_ time Arrival_ Arrival_ airport_code time
FARE
Flight_number Fare_code Amount Restrictions
AIRPLANE_TYPE
Airplane_type_name Max_seats Company
CAN_LAND
Airplane_type_name Airport_code
AIRPLANE
Airplane_id Total_number_of_seats Airplane_type
SEAT_RESERVATION
Flight_number Leg_number Date Seat_number Customer_name Customer_phone
5.14 - Consider the following six relations for an order-processing database application in a company: CUSTOMER(Cust#, Cname, City) ORDER(Order#, Odate, Custw, Ord Amt) ORDER_ITEM(Order#, Item#, C2ty) ITEM(Item#, Unicprice) SHIPMENT(Order#, Warehouse#, Ship_date) WAREHousE(Warehouse#, City) Here, Ord_Amt refers to total dollar amount of an order; Odate is the date the order was placed; Ship_date is the date an order is shipped from the warehouse. Assume that an order can be shipped from several warehouses. Specify the foreign keys for this schema, stating any assumptions you make. Jawaban : Foreign Key yang tampak pada tabel tersebut adalah : Custw pada tabel Order me-reference ke Cust pada tabel Customer. Order pada tabel Order_item me_reference ke Order pada tabel Order. Item pada tabel Order_item me-reference ke Item pada tabel Item. Order pada tabel Shipment me-reference ke Order pada tabel Order. Warehouse pada tabel Shipment me-reference ke Warehouse pada tabel Warehouse.
5.17 - Consider the following relations for a database that keeps track of auto sales in a car dealership (Option refers to some optional equipment installed on an auto): cAR(Serial-No, Model, Manufacturer, Price) OPTIoNs(Serial-No, Option-Name, Price) sALEs(Salesperson-id, Serial-No, Date, Sale-price) sALEsPERsoN(Salesperson-id, Name, Phone) First, specify the foreign keys for this schema, stating any assumptions you make. Next, populate the relations with a few example tuples, and then give an example of an insertion in the SALES and SALESPERSON relations that violates the referential integrity constraints and of another insertion that does not. Jawaban : Foreign Key yang bisa dibuat pada tabel tersebut adalah : Serial_no pada tabel Options me-reference ke Serial_no pada tabel Car. Serial_no pada tabel Sales me-reference ke Serial_no pada tabel Car. Salesperson_id pada tabel Sales me-reference ke Salesperson_id pada tabel Salesperson.
Diagram :
LOCATION
TOTAL_ OCCUPIED_AREA
SPORTS_ COMPLEX
CHIEF_ ORGANIZER
FACILITIES
ONE_SPORT
INFORMATION
MULTI_SPORT
BUDGET
DURATION
EVENTS
PLANNED_DATE
NUMBER_OF_ PARTICIPANTS
OFFICIAL ID
EQUIPMENT ID
OFFICIAL
EQUIPMENT
EQUIPMENT_ NAME
OFFICIAL_NAME
4.20 - Design a database to keep track of information for an art museum. Assume that the following requirements were collected: The museum has a collection of ART_OBJECTS. Each ART_OBJECT has a unique IdNo, an Artist (if known), a Year (when it was created, if known), a Title, and a Description. The art objects are categorized in several ways, as discussed below. ART_OBJECTS are categorized based on their type. There are three main types: PAINTING, SCULPTURE, and STATUE, plus another type called OTHER to accommodate objects that do not fall into one of the three main types. A PAINTING has a PaintType (oil, watercolor, etc.), material on which it is DrawnOn (paper, canvas, wood, etc.), and Style (modem, abstract, erc.). A SCULPTURE or a STATUE has a Material from which it was created (wood, stone, etc.), Height, Weight, and Style. An art object in the OTHER category has a Type (print, photo, etc.) and Style. ART_OBJECTS are also categorized as PERMANENT_COLLECTION, which are owned by the museum (these have information on the DateAcquired, whether it is OnDisplay or stored, and Cost) or BORROWED, which has information on the Collection (from which it was borrowed), DateBorrowed, and DateRetumed. ART_OBJECTS also have information describing their country/culture using information on country/culture of Origin (Italian, Egyptian, American, Indian, etc.) and Epoch (Renaissance, Modem, Ancient, etc.). The museum keeps track of ARTIST'S information, if known: Name, DateBom (if known), DateDied (if not living), CountryOfOrigin, Epoch, MainStyle, and Description. The Name is assumed to be unique. Different EXHIBITIONS occur, each having a Name, StartDate, and EndDate. EXHIBITIONS are related to all the art objects that were on display during the exhibition. Information is kept on other COLLECTIONS with which the museum interacts, including Name (unique), Type (museum, personal, etc.), Description, Address, Phone, and current ContactPerson. Draw an EERschema diagram for this application. Discuss any assumptions you made, and that justify your EERdesign choices. Asumsi : Art object bisa menjadi painting atau sculpture atau statue atau other. Art object pasti merupakan barang yang permanent atau borrowed (pinjaman). 1 art object dibuat oleh 1 artis, 1 artis bisa membuat banyak art object. 1 art object dipajang di 1 exhibition, 1 exhibition bisa memajang banyak art object. Painting, sculpture, statue and other dapat dikumpulkan jadi satu menjadi collection. 1 collection dipunyai oleh 1 owner, 1 owner bisa mempunyai banyak collection.
Diagram :
COUNTRY OF ORIGIN NAME ID NO YEAR TITLE DESCRIPTION
EPOCH
ARTIS
MADE BY
MATERIAL
ART OBJECT
TYPE
d
DATE ACQUIRED
EXHIBITON NAME
EXHIBITION
OCCURS
PERMANENT
START DATE END DATE STATUS COST
BORROWED
DATE BORROWED
DATE RETURNED
PAINT TYPE
PAINTING
SCULPTURE
STATUE
OTHER
HEIGHT
WEIGHT
CONTACT PERSON
ADDRESS
COLLECTION
OWNS
OWNER
PHONE
4.27 Consider the following EER diagram that describes the computer systems at a company. Provide your own attributes and key for each entity type. Supply max cardinality constraints justifying your choice. Write a complete narrative description of what this EER diagram represents. Diagram :
REQUIREMENTS SPECIFICATION COMPUTER_TYPE PRICE VERSION
M
SOLD_WITH
INSTALLED
SOFTWARE
COMPUTER
M
INSTALLED_OS
OPERATING_ SYSTEM M
SIZE
M
LAPTOP
FACTORY
DESKTOP M
COMPONENT_ TYPE
ACCESSORY
MEM_OPTIONS
OPTIONS
COMPONENT
SUPPORTS
ID_PRODUCT
d
CAPACITY
MEMORY
SOUND_CARD
VIDEO_CARD
KEYBOARD
MONITOR
MOUSE
Deskripsi : Computer mempunyai data yaitu computer_type, specification, price. Computer bisa menjadi laptop atau desktop, dimana laptop akan melekat data size. Computer akan diinstal software dimana dalam software akan tercatat requirements dan version. Computer juga pasti diinstall operating_system. Computer yang dijual harus bersama dengan accessory yang memiliki informasi id_product (unik), factory. Accessory dapat berupa keyboard, monitor, atau mouse. Laptop pasti memiliki memori yang terbaca capacity memory tersebut. Desktop terdiri dari component-component. Component dapat berupa memory, sound_card atau video_card. Component juga menyuport untuk berlangsugnya software.