0% found this document useful (0 votes)
899 views

Assignment

This document discusses database concepts like ER modeling, keys, relationships and integrity. It provides examples of database tables, identifies primary keys, foreign keys, candidate keys and relationship types. It also defines database terms and has questions about identifying entities, keys, relationships and modeling databases using ERD diagrams.

Uploaded by

Marvin Cinco
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
899 views

Assignment

This document discusses database concepts like ER modeling, keys, relationships and integrity. It provides examples of database tables, identifies primary keys, foreign keys, candidate keys and relationship types. It also defines database terms and has questions about identifying entities, keys, relationships and modeling databases using ERD diagrams.

Uploaded by

Marvin Cinco
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1. What two concepts are ER modelling based on?

Entities and Relationships

2. The database in Figure 8.11 is composed of two tables. Use this figure to
answer questions 2.1 to 2.5.
1. Identify the primary key for each table.
Primary key for DIRECTOR table is DIRNUM.
Primary key for PLAY table is PLAYNO.

2. Identify the foreign key in the PLAY table.


Foreign key in PLAY table is DIRNUM.

3. Identify the candidate keys in both tables.


Candidate keys in both tables is DIRNUM.

4. Draw the ER model.


5. Does the PLAY table exhibit referential integrity? Why or why
not?

3. Define the following terms (you may need to use the Internet for some of
these):

schema - is an overall description of a database, and it is usually


represented by the entity relationship diagram (ERD).

host language – The language that  is used for database application


programming.

data sublanguage - A language or part of a language concerned only


with database query and update and/or
database
definition.

data definition language - is a computer language used to create and


modify the structure of database objects in
a database.

unary relation – is when both participants in the relationship are


the
same entity.
foreign key - is a column or group of columns in a relational
database table that provides a link between data in
two
tables.

virtual relation - means having a relationship with someone in the


world that physically does not exist but is made to
appear so by a software.

connectivity - the state or extent of being connected or


interconnected.

composite key - is  a candidate key that consists of two or more


attributes (table columns) that together uniquely
identify an entity occurrence (table row). 

linking table - is a very common requirement in SQL. 

4. The RRE Trucking Company database includes the three tables in Figure
8.12. Use Figure 8.12 to answer questions 4.1 to 4.5.

1. Identify the primary and foreign key(s) for each table.


Primary key:
 Table TYPE primary key is TYPENUM
 Table BASE primary key is BASENUM
 Table TRUCK primary key is TNUM.

Foreign key:
 Table TYPE no foreign key
 Table BASE no foreign key
 TABLE TRUCK foreign keys are BASENUM references
table BASE TYPENUM references table TYPE

2. Does the TRUCK table exhibit entity and referential integrity?


Why or why not? Explain your answer.
 TRUCK table exhibits referential integrity because
column BASENUM having the values that are present
in the base table and hence accuracy is mentioned.
 Also, column TYPENUM contains all the values that
are present in the TYPE table BASENUM
3. What kind of relationship exists between the TRUCK and BASE
tables?
 BASE and TRICK table is having one to many
relationships.
 One BASE is linked to many trucks.
 But TRUCK can be linked to only one BASE.

4. How many entities does the TRUCK table contain?


 Entity in a table represents an attribute in the table.
 A TRUCK table is having 6 entities.

5. Identify the TRUCK table candidate key(s).


 In the TRUCK table TSERIAL is candidate key because
TSERIAL is uniquely identify each TRUCK

5. Suppose you are using the database in Figure 8.13, composed of the two
tables. Use Figure 8.13 to answer questions 5.1 to 5.6.
1. Identify the primary key in each table.
 Customer Table: CustID is primary key for the table as
the id for each customer will be unique.
 Book Orders Table: OrderID is primary key for the
table as OrderID will be quique for each order stored
in the table

2. Identify the foreign key in the Book Orders table.


 Foreign key in BookOrder is CustID as it stores orders
made by the customers store in customer table based
on the CustID values.

3. Are there any candidate keys in either table?


 Customer table ‘s candidate key: This table has a
AcctNo as candidate key as it is expected that every
customer will have his own account number which
will differ from other customer’s account number.
 BookOrder table’s candidate key: This table has a
composition of (Title, CustID) as candidate key based
on the assumption that a customer will not order a
book with same title again
4. Draw the ER model.

5. Does the Book Orders table exhibit referential integrity? Why or


why not?
 The given table BookOrders has a referential key CustID
which is unique and not null in Customer table. In given
scenario Customer is primary table and BookOrders is
child table.
 BookOrder stores the orders placed to buy a book where a
book is ordered by a Customer. Thus, Order should store
its referred customer (CustID). The only CustID values
which are available in Customer table are allowed to be
entered in the BookOrders table i.e. a BookOrders table
cannot have an order record with CustID 103 untill it has
an entry in Customer table with CustID = 103. Thus, it
exhibits the referential integrity

6. Do the tables contain redundant data? If so which table(s) and


what is the redundant data?
 Given table BookOrders has redundancy in it as:
o Title: Same title is being repeated for different
orders. Instead, it should have a reference to
Book’s title e.g. 1, 2,3
o Price: Book Price is redundant in the table. ‘The
Dark Tower’ has price 12, which is added twice
in the table.

6. Looking at the student table in Figure 8.14, list all the possible candidate
keys. Why did you select these?
Nothing.

7. Use the ERD of a school database in Figure 8.15 to answer questions 7


to 10.
kernel entities are the independent entities. The database is based
on that entity. Here it is the student entity. Dependent entity
means they are dependent on some entity. Here it is offering.
Characteristic entities are extension of kernel entity. Here it is
attendance.

8. Identity all the kernels and dependent and characteristic entities in the
ERD.
Here attendance is the weak entity or table which has weak
relationships. Course and Instructor has the strong relationship.

9. Which of the tables contribute to weak relationships? Strong


relationships? Looking at each of the tables in the school database in
Figure 8.15, which attribute could have a
NULL value? Why?
Here in student table fax_no can be null because they does not
have fax_no,again a student may or may not have
passport_program , so this attribute can be null, company_id can
also have null. In instructor table mentor_id can be null because
instructor may or may not be a mentor

10. Which of the tables were created as a result of many to many


relationships?
Student and instructor created as a result of many to many
relationships because one student can have many instructor and
one instructor can have many stud

You might also like