You are on page 1of 3

There are several differences between a relation and ordinary file.

The main difference is the


appearance. For instance, a relation has the appearance with multiple additions that organizes
files. However, a regular or ordinary file Is simply files or data that is physically kept. For
example, there are many things that a relation consists of. The first thing is that a relation has
unique names that sets it apart from other relations, so these types of data files are not able to
have duplications within the table. With that being said, there should be only one attribute that
is the same.

A foreign key can be either one-to-one or implemented into a one-to-many relationship


database. In a one-to-one relationship, a record in one table is linked to another one. However,
in a one-to-many relationship one record in a table can be linked or partnered with many
records in other tables. For instance, one single person can order something, but they can have
several orders that links back to them. The foreign keys relate all information in a one-to-many-
relationship because it makes it easy to filter and relate data.

Intersection data can be easily identified by the first word. An intersection is known for
combining two or more sets. Intersection data combines occurrences of an entity from one to
another in a one-to-many relationship It does not describe a single entity because it involves a
one-to-many relationship which means that the occurrences are combined.

SHIP Relation
Ship # Number Ship Name Ship Builder Launch Date Gross Weight

Cruise Relation
Cruise # Start Date End Date Cruise Director Ship #

PORT Relation
Port Name Country # of Docks Port Manager

VISIT Relation
Cruise # Port Name Country Arrival Date Departure Date

PASSENGER
Relation
Cruise # Port Name Country Arrival Date Departure Date

VOYAGE
Relation
Passenger # Cruise # Stateroom # Fare

Candidate Keys?
• Ship Relation - Ship Number & Ship Name
• Cruise Relation - Cruise Number & Cruise Director
• Port Relation - Port Name & Port Manager
• Visit Relation - Cruise Number Port Name Arrival Date
• Passenger Relation - Passenger Number Passenger Name
• Voyage Relation - Passenger Number Cruise Number Stateroom Number
b. Primary Key
• Ship Number
• Cruise Number Ship Number
• Port Name
• Cruise Number Port Name
• Passenger Number
• Fore - Passenger Number, Cruise Number, Stateroom Number
c.
• Ship: 0
• Cruise: 1
• Port: 0
• Visit: 2
• Passenger: 0
• Voyage: 2
d.
• Cruise: Ship Number
• Visit: Cruise Number
• Port: Name
• Voyage: Passenger Number, Cruise Number
e.
• When using Visit and Voyage relations, both parts of their primary keys are also foreign
keys. When looking at the section of “Visit” it’s the port name, country and cruise # where in
Voyage it is the cruise number and passenger number. With that being said, they are all many to
many relationships.
f. Identify the relations that support many-to-many relationships, the primary keys of those
relations, and any intersection data.
VISIT Relation support many-to-many relationship between cruise and port. Primary key for
cruise is cruise number and for port is combination of port name and country finally for Visit
combination of cruise number and port name and country. VOYAGE Relation support many-to-
many relationship between passenger and cruise. Primary key for passenger is passenger number
and for cruise is cruise number and for Voyage is combination of passenger number and cruise
number. Intersection data are VISIT Relation and VOYAGE Relation.
g. Using the informal relational command language described in this chapter, write commands
to:
• select record from passenger where passenger number = 473942
• select record from port where port name = Nassau and country = Bahamas
• select all records from ship where ship builder = General Shipbuilding,Inc
• select all port name and number of docks from port where country = Mexico.
• select all name and number from ship
• select cruise director from cruise where cruise number = 39232
• select gross weight from ship where Join the cruise and ship using cruise number = 39482
• select all home address from passenger where Join the cruise and passenger and using
cruise number = 17543

You might also like