Preview

Entity Relationship Diagram

Good Essays
Open Document
Open Document
367 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Entity Relationship Diagram
#1. Entity Relationship Diagram

#2. a. & b.

One Room can be designated only one Room Type, whilst a particular Room Type can be assigned to several rooms (i.e. there may be many rooms that have double beds). Therefore, Room has a one-to-one relationship with RoomType and RoomType has a one-to-many relationship with Room.

From the table, it can be seen that a particular room can only be designated as belonging to one type / category, thus confirming that Room RoomType has a one-one relationship. From the table we can also see that RoomType occurs several times, thus confirming that RoomType Room has one-many relationship.

#2 C.

CREATE TABLE ROOM(
RoomId varchar2(5) Not Null;
RoomTypeId varchar2(10) Not Null;
AvailableStatus varchar2(10) Not Null;
PRIMARY KEY(RoomId);
FOREIGN KEY (RoomTypeId) references ROOMTYPE (RoomTypeID);

The cardinalities of the relationship between Room and RoomType shown in my ERD specifies that each Room is uniquely identified by a RoomId, which can be described by only one of all available RoomTypes. As such, each RoomId must be classified into a RoomType, and therefore, in accordance with entity integrity, both primary keys must not be null. Since RoomType will occur several times in the RoomTable, it should be “NotNull” as not null condition must be defined for the dependent table’s foreign key, but because of its multiple occurrence, RoomType cannot be “unique”.

#3. The Registration table has two (2) foreign keys, RoomId and EmpId. These foreign keys are attributes in one table, and then are primary keys in another relation. It can be seen that GuestId is the primary key of the Guest table, and serves as a link to the Registration table. Since the Guest ID can exist as a foreign key within the Registration Table, it can exist many times, hence the cardinality values between the tables were determined.

From the sample data above it can be seen that RoomId’s were

You May Also Find These Documents Helpful

  • Good Essays

    Service Request SR-ht-03

    • 569 Words
    • 2 Pages

    Next is the explanation of what are in the tables and the entity relationship between them. Table Tire Maintenance, this table has a relationship with Table Vehicle Maintenance. Their relationship is when the maintenance type ID is entered into the database it is automatically connected to the Table Maintenance work order section of the database. Table Maintenance work order has a relationship with Table Vehicle Types for type of vehicle. Part ID relates to Table parts Inventory Issues to link any kind of parts inventory subjects. Table Parts Inventory Issues has a relationship with Table Parts Inventory Purchases for any type of purchase information. Table Parts Catalogue has relationship with Table…

    • 569 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    The room descriptor will include the type and number of beds available and other amenities…

    • 412 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    PT2520 Unit7Labs Tramil

    • 330 Words
    • 1 Page

    3. What is a foreign key? This primary key becomes a foreign key when it is repeated in another table to create a link between the tables.…

    • 330 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    It203 Homework 5

    • 319 Words
    • 2 Pages

    Once the tables are created and the relationship is established, the data can be entered. In general, data can be placed in tables containing foreign keys only after the data is entered into the tables that they reference. This restriction means that data must be inserted first into the MEMBER table. If not, the data for the VISIT table will be rejected for the referential integrity…

    • 319 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    # Select a primary key for each table as indicated in the provided ERD diagram.…

    • 694 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    7) In a one-to-many relationship, each row on in the primary key table can be related to any number of rows in the foreign key or child table.…

    • 613 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Pt2520 Final Answers 1/3

    • 329 Words
    • 2 Pages

    what best describes the function of a foreign key. the primary key repeated in another table to show relation…

    • 329 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    IST223 Crib sheet

    • 3425 Words
    • 7 Pages

    rectangles, and relationships are shown by lines between the rectangles. Attributes are generally listed within the rectangle. The many side of many relationships is represented by a crows footentity-relationship (E-R) modelA set of constructs and conventions used to create data models. The things in the users world are represented by entities, and the associations among those things are represented by relationships. The results are usually documented in an entity-relationship (E-R) diagramID-dependent entityan entity whose identifier includes the identifier of another entityidentifierwhich are attributes that name, or identify, entity instancesidentifying relationshipIn such relationships, the parent is always required, but the child (the ID-dependent entity) may or may not be required, depending on application requirements. Identifying relationships are shown with solid lines in E-R diagrams.is-aRelationships among supertype/subtype entitiesmandatoryat least one entity instance must participate in the relationshipmaximum cardinalityThe maximum cardinality is the maximum number of entity instances that can participate in a relationship instance.minimum cardinalityThe minimum cardinality is the minimum number of entity instances that must participate in a relationship instance.nonidentifying relationshiprelationship drawn with a dashed line (refer to Figure 5-7) is used between strong entities and is called a nonidentifying relationship because there are no ID-dependent entities in the relationship.null valueare a problem because they are ambiguous. They can mean that a value is inappropriate, unknown, or known, but not yet been entered into the databaseparentAn entity or row on the one side of a one-to-many relationshiprecursive relationshipoccurs when an entity type has a relationship to itself.relationship classAssociations among entity classesrelationship instanceassociations among entity instances.strong entityan entity that represents something that can exist…

    • 3425 Words
    • 7 Pages
    Powerful Essays
  • Satisfactory Essays

    cis3730_Exam1_Studyguide

    • 512 Words
    • 2 Pages

    Be able to give examples of tables, specify their primary keys, and explain how they are related through foreign keys.…

    • 512 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Defining a(n) primary key in a second table creates a relationship between that table and the table where the primary key was first defined. _________________________…

    • 585 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    b) You are to clearly mark Primary and Foreign Keys as shown in the sample below:…

    • 1494 Words
    • 19 Pages
    Powerful Essays
  • Satisfactory Essays

    Is3110 Chapter 1

    • 789 Words
    • 4 Pages

    | 4. The most common type of relationship you will encounter between tables is the many-to-one relationship.…

    • 789 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    Anime LIst

    • 11441 Words
    • 52 Pages

    Which of the following fields also serves as a primary key in another table when two tables…

    • 11441 Words
    • 52 Pages
    Good Essays
  • Satisfactory Essays

    Information Systems

    • 386 Words
    • 2 Pages

    d) Explain how the two tables are related. Which table contains the foreign key? What is the foreign key?…

    • 386 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    My Sql

    • 1999 Words
    • 8 Pages

    This query will create a table create table furniture ( no int(6) NOT NULL PRIMARY KEY, itemname varchar(20) default NULL, type varchar(10) default NULL, dateofstock date default NULL, price decimal(6,0), discount int(2) ); Query OK, 0 rows affected (0.22 sec) This query will create a table create table arrival ( no int(6) NOT NULL PRIMARY KEY, itemname varchar(20) default NULL, type varchar(20) default NULL, dateofstock date default NULL, price int(6) default NULL, discount int(2) ); Query OK, 0 rows affected (0.22 sec) mysql> desc furniture; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+ | no | int(6) | NO | PRI | NULL | | | itemname | varchar(20) | YES | | NULL | | | type | varchar(10) | YES | | NULL | | | dateofstock | date | YES | | NULL | | | price | decimal(6,0) | YES | | NULL | | | discount | int(2) | YES | | NULL | | +-------------+--------------+------+-----+---------+-------+ 6 rows in set (0.00 sec) inserting values into the table furniture and arrival insert into furniture values(1,"white lotus","double Bed","2002/02/23",30000,25); insert into furniture values(2,"Pink Feather","Baby cot","2002/01/20",7000,20); insert into furniture values(3,"Dolphine","Baby cot","2002/02/19",9500,20); insert into furniture values(4,"Decent","Office Table","2002/01/01",25000,30); insert into furniture values(5,"Comfort Zone","Double Bed","2002/01/12",25000,25); insert into furniture values(6,"Donald","Baby cot","2002/01/12",6500,15); insert into furniture values(7,"Royal Finish","office Table","2002/10/20",18000,25); insert into furniture values(8,"Royal Tiger","Sofa","2002/03/22",31000,25); insert into furniture…

    • 1999 Words
    • 8 Pages
    Satisfactory Essays