You are on page 1of 5

QUESTIONS / EXERCISES

(Review for Final)


By: LONG Nipaul

Questions
1. What is a RDBMS stand for? What is its roles?
2. What is the main roles for DB Administrator position?
3. What are the steps for Database Design? Which Database Model is used in
Conceptual Design?
4. What are the main elements of Entity/Relationship model? Explain each of them.
5. In E/R model, what is an entity? What is an attribute? What is relationship attribute?
6. What is the notation for Entity, Relationship, Primary Key?
7. What are Relationship Type in E/R Model? Give an example for each of them.
8. When you have a problem, what are the steps to build E/R model?
9. In Relational Model, explain what is Domain? Tuple? Superkey? Candidate key?
10. What is tuple? What is Relational Schema? What is Relational Instance?
11. In Relational Algebra, what does Selection do? what does Projection do? what does
Cartesian product do? what does Natural Jointure do? what does Renaming do? what
does Intersection do?
Answer
1. An RDBMS is a Relational Database Management System. An RDBMS is a
collection of software that stores, modifies and retrieves data and accesses it
through relationships between sets of data.
2. What are the main roles for DB Administrator position? -Answer:
- Maintenance DBA: Manages, support and can recover database.
- The Database Developer: Programming background and performs lots of
SQL statement
- Data Architect: Looking at companys processes, defining what data is to be
stored and how itll be accessed.
3. What are the steps for Database Design? Which Database Model is used in
Conceptual Design? entity-relationship model.
Conceptual design:
- Data modeling creates an abstract database structure
o Represents real-world objects
- Embodies clear understanding of business and its functional areas
- Ensure that all data needed are in model, and that all data in model are
needed
Logical design
- Translate conceptual design into internal model
- Logical design is software-dependent
- Requires all objects be mapped to specific constructs used by selected
database software
o Definition of attribute domains, design of required tables, access
restriction formats
o Tables must correspond to entities in conceptual design
- Translates software-independent conceptual model into software-
dependent model

Physical design
- Process of selecting data storage and data access characteristics of
database
- Storage characteristics are function of:
o Device types supported by hardware
o Type of data access methods supported by system
o DBMS
- More complex when data are distributed

During the Conceptual Design ER model has been used to Integrates with
relational model. The scenario is partitioned into entities which are
characterized with attributes and interrelated via relationships. Entity set is a
set of entities of the same type.
4. 3 Main elements of Entity/Relationship model.
- Entity: Entity is an object that exists and is distinguishable from other
objects.
Example: specific person, company, event, plant
- Attribute: An entity is represented by a set of attributes that is
descriptive properties possessed by all members of an entity set.
Ex.
customer = (customer-id, customer-name, customer-street, customer-city)
loan = (loan-number, amount)
- Relationship: A relationship is an association among several entities.
Example: Hayes depositor A-10
customer entity relationship account entity
5. The same as number 4 question.
6. Notation for Entity, Relationship, Primary Key
- Entity: represented by a rectangle with its name in capital letters.
- Relationships: represented by an active or passive verb inside the
diamond that connects the related entities.
- Primary key: mostly represented by the name of the attribute and was
underlined.
7. Relationship Types in E/R Model. Explain each.
- One to one: a customer is associated with at most one loan via the
relationship borrower. A loan is associated with at most one customer
via borrower.
- One to many: In the one to many relationship a loan is associated with at
most one customer via borrower, a customer is associated with several
loans via borrower.
- Many to many: a customer is associated with several loans via borrower.
A loan is associated with several customers via borrow.
8. Step to build E/R Model
- Step1: Set entities that have in the problem
- Step2: find all attributes in each entities
- Step3: define the relationship of the entities
- Step4: draw E/R diagram that show the relationship of each entities and the
attribute of each entities
9. Domain, Super Key, Candidate Key
- Domain the set of permitted values for each attribute
- A super key of an entity set is a set of one or more attributes whose values
uniquely determine each entity.
- A candidate key of an entity set is a minimal super key
o Customer-id is candidate key of customer
o account-number is candidate key of account
10. Tuple, Relational Schema, Relation Instance
- In the context of databases, a tuple is one record (one row). Or a single row
of a table, which contains a single record for that relation is called a tuple.
- A set of attributes is called a relation schema (or relation scheme). A
relation schema is also known as table schema (or table scheme). A relation
schema can be thought of as the basic information describing a table or relation.
It is the logical definition of a table. Relation schema defines what the name of
the table is. This includes a set of column names, the data types associated with
each column. Or Relation schema is a relation schema describes the relation
name (table name), attributes, and their names.
- Relation instance A finite set of tuples in the relational database system
represents relation instance. Relation instances do not have duplicate tuples.
11. Selection, Project, Cartesian Product, Rename, Natural Join, Intersection.
- Select Operation: This operation is used to select rows (tuples) from a table
(relation) that specifies predicate. The predicate is a user defined condition to
select rows of user's choice.
- Project Operation: This operation is used to select columns (attribute) from
a table (relation) that specifies predicate.
- Cartesian product: This operation is used to combine information of two
different relations into one.
- Rename: This operation allows us to rename the output of the specify table
or relation.
- Natural Jointure: In the SQL language, the NATURAL JOIN command makes
it possible to make a natural join between 2 tables. This join is performed on the
condition that there are columns of the same name and type in both tables. The
result of a natural join is the creation of an array with as many rows as there are
pairs corresponding to the association of columns with the same name.
- Intersection: The SQL INTERSECT clause/operator is used to combine two
SELECT statements, but returns rows only from the first SELECT statement that
are identical to a row in the second SELECT statement. This means INTERSECT
returns only common rows returned by the two SELECT statements.

Exercise
Relational Algebra

Answer the following questions using Relational Algebra expression:

1. Give all the courses that was update before November 21st 2018.
2. Give all the courses' title that have not set the fee.
3. Give all the courses' ID that has credit less than 3.

Answer:
Translation

Translate the following E/R diagram into Relational Model.