Database Systems
Database Systems
Specific objectives
Describe the relational database model and outline its basic features.
Identify the common functions performed by all database management systems
Identify popular database management systems.
Identify and briefly discuss current database applications.
Introduction
A database is an organized collection of data. Like other components of an information system, a
database should help an organization achieve its goals. A database can contribute to organizational
success by providing managers and decision makers with timely, accurate, and relevant information
based on data.
Database management system (DBMS) consists of a group of programs that manipulate the database
and provide an interface between the database and its users and other application programs. Usually
purchased from a database company, a DBMS provides a single point of management and control over
data resources, which can be critical to maintaining the integrity and security of the data. A database, a
DBMS, and the application programs that use the data make up a database environment. A database
administrator (DBA) is a skilled and trained IS professional who directs all activities related to an
organization’s database, including providing security from intruders.
Data is generally organized in a hierarchy that begins with the smallest piece of data used by computers
(a bit) and progresses through the hierarchy to a database. A bit (a binary digit) represents a circuit that
is either on or off. Bits can be organized into units called bytes. A byte is typically eight bits. Each byte
represents a character, which is the basic building block of information. A character can be an uppercase
letter (A, B, C… Z), lowercase letter (a, b, c… z), numeric digit (0, 1, 2… 9), or special symbol (., !, [+], [-]…).
Characters can be combined to form a field. A fieldis typically a name, number, or combination of
characters that describes an aspect of a business object (such as an employee, a location) or activity
(such as a sale). In addition to being entered into a database, fields can be computed from other fields.
Computed fields include the total, average, maxi mum, and minimum values. A collection of related data
fields is a record. By combining descriptions of the characteristics of an object or activity, a record can
provide a complete description of the object or activity. For instance, an employee record is a collection
1
of fields about one employee. One field includes the employee’s name, another field contains the
address, and still others the phone number, pay rate, earnings made to date, and so forth. A collection
of related records is a file—for example; an employee file is a collection of all company employee
records. Likewise, an inventory file is a collection of all inventory records for a particular company or
organization. Some database software refers to files as tables.
At the highest level of this hierarchy is a database, a collection of integrated and related files. Together,
bits, characters, fields, records, files, and databases form the hierarchy of data (see Figure 5.1).
Characters are combined to make a field, fields are combined to make a record, records are combined to
make a file, and files are combined to make a database. A database houses not only all these levels of
data but also the relationships among them.
2
II) Data Entities, Attributes, and Keys
Entities, attributes, and keys are important database concepts. An entity is a generalized class of people,
places, or things (objects) for which data is collected, stored, and maintained.
Examples of entities include employees, inventory, and customers. Most organizations organize and
store data as entities.
An attribute is a characteristic of an entity. For example, employee number, last name, first name, hire
date, and department number are attributes for an employee (see Figure 5.2).
The inventory number, description, number of units on hand, and location of the inventory item in the
warehouse are attributes for items in inventory. Customer number, name, address, phone number,
credit rating, and contact person are attributes for customers. Attributes are usually selected to reflect
the relevant characteristics of entities such as employees or customers. The specific value of an
attribute, called a data item, can be found in the fields of the record describing an entity.
3
III) Differences between computerized and paper base database
Computerized database Paper-based database
It can hold a vast amount of data The amount of data is limited by the storage space
Very fast to find specific record Can take a while to go through a record
Little chances of data redundancy Very high chances of data redundancy
Data can be easily analyzed Very difficult to analyze the data
Data can be stored on many criteria Difficult to sort data on more than one criterion
Records are stored safely, they are available record can be can be misfiled making them hard to
when needed find or retrieve
The database can be kept secured by the use The only security will to up the record
of password
Easy to make a backup Difficult to make a backup because every page will
have to be rewritten or photocopied
Within the database, the data are organized into storage containers, called tables. Tables are
made up of columns and rows. In a table, columns represent individual fields and rows represent
records of data. The following are the basic database terms.
A table is the database object that contains the basic data or information you wish to store
about an entity of the database. For example, a collection of all the employee records of a
company’s database form employee table.
II.2.1 Field
A field represents one related column of a table and is the smallest logical structure of storage in
a database. It holds one piece of information about an entity or a subject represented by the table.
4
For example, in a database maintaining information about employee, the fields can be Code,
Department, Name, Address, City and Phone etc...
II.2.2 Record
A record, is a collection of multiple related fields that can be treated as a unit; another way of
saying it, a record is a row of the table for a database, which contains a collection of attributes
related to an entity (such as a person or product) of the database. For example, fields Code1,
Department1, Name1, Address1, City1 and Phone1 for a particular employee form a record.
Queries
A query is the database tool that allows you to retrieve information from one or more tables
based on a set of search conditions you define using the table fields.
For example, if you want to know the name of the books that have sold in Colorado and Kansas,
you could create a query that would retrieve information from multiple tables to determine the
answer. In this example, you would retrieve information from the Order table and Books table.
Queries are covered in more detail in later lessons.
Forms
Forms are an Access tool that users can create to make data entry in database tables easier.
Entering data directly into a table can be difficult if there is a lot of information to enter. Like an
Excel spreadsheet, an Access table is essentially a screen filled with blank rows where a user
enters records. Forms, however, provide users with an easy-to-read interface where they can
enter table data. Forms are especially useful for Access users that aren’t comfortable working
with databases.
Reports
The final database object is the report. A report is an effective tool that gives you way to
analyze and present data using a specific layout. The text can be formatted in an Access report,
just like it can be in Word documents.
4 Keys
A key is a data item that allows us to uniquely identify individual occurrences or an entity type.
You can sort and quickly retrieve information from a database by choosing one or more fields (ie
attributes) to act as keys. For instance, in a student's table you could use a combination of the last
name and first name fields (or perhaps last name, first name and birth dates to ensure you
identify each student uniquely) as a key field. There exist many types of keys:
5
a) Primary Key:
A field or a set of fields that uniquely identify each record in a table is known as a primary key.
This implies that no two records in the relation can have same value for the primary key. A
Primary Key is the first field in each table of the database, which enables to identify in unique
way each field of a database table. You may recall that this field is auto numbers by default, so
that every record in the table has its own unique number to identify [Link] example, your
student number is a primary key as this uniquely identifies you within the college student records
system. An employee number uniquely identifies a member of staff within a company. An IP
address uniquely addresses a PC on the internet.
A primary key is mandatory. That is, each entity occurrence must have a value for its primary
key. In the example below, the primary key for the Customers table is Customer ID, the primary
key for the Orders table is Order ID, and the primary key for the Books table is Book ID.
b) Foreign Key:
A field of a table that references the primary key of another table is referred to as foreign key.
Another way of saying it, a Foreign Key is a field that is the Primary Field in its own table, but
that shows up in another table. in the example above, If you look closely at the Orders table,
the fields Customer ID and Book ID appear there, as well as in their own respective tables.
These fields are the primary key in their own tables, but in the Orders table, they are
considered Foreign Keys.
1) Candidate Key:
In a table, there can be more than one field that can uniquely identify each record. All such fields
are known as candidate keys. One of these candidate keys is chosen as a primary key; the other
keys that are not chosen as primary key are known as alternate keys or secondary keys.
NOTE: The key composed of more than one field is known as composite key. Sometimes, it is
also known as concatenated key or structured key.
6
Figure 8. Foreign Key
2) Simple Key
Any of the keys described before (ie: primary, secondary or foreign) may have one or more
attributes. A simple key consists of a single attribute to uniquely identify an entity occurrence,
for example, a student number, which uniquely identifies a particular student. No two students
would have the same student number.
3) Compound Key
A compound key consists of more than one attribute to uniquely identify an entity occurrence.
Each attribute, which makes up the key, is also a simple key in its own right.
A data type determines the type of data that can be stored in a column of field of a table in the
database. Although many data types are available, the followings are the most commonly used
data types :
7
the computer when a new
record is added
Yes/No Boolean values (true and 1bit
false) data 1=true 0=false
Lookup wizard Allow the creation of Up to 255 characters per
multivalued fields. Display values
in drop-down list.
Hyperlink For storing web/email 1GB
address, allow single click
access, allow link to object
in another database
OLEobject Used to embed or link object Up to 1G
created in another office
applications
Attachement Store digital image or files 2 GB compressed
attachements to the record
Even though a relationship may involve more than two entities, the most commonly encountered
relationships are binary, involving exactly two entities. Generally, such binary relationships are
of three types and called cardinality: one-to-one, one-to-many and many-to-many.
One-to-one is where one occurrence of an entity relates to only one occurrence in another entity,
eg if a man only marries one woman and a woman only marries one man, it is a one-to-one (1:1)
relationship.
Fig 5 : One-to-One
8
Fig 6: One-to-Many
In many-to-many relationship, one record in a table can be related to one or more records in a
second table, and one or more records in the second table can be related to one or more records
in the first table. For example, One teacher teaches many students and a student is taught by
many teachers.
Integrity ensures that the data in a database is both accurate and complete, in other words, that
the data makes sense. There are at least five different types of integrity that need to be
considered: Domain constraints, Entity integrity, Column constraints, User-defined integrity
constraints, Referential integrity. The data analysis stage will identify the requirements of these.
Domain Constraints: A domain is defined as the set of all unique values permitted for
an attribute. For example, a domain of Date is the set of all possible valid dates, a domain
of Integer is all possible whole numbers, and a domain of day-of-week is Monday,
Tuesday ... Sunday.
Entity Integrity: It implies that no component of a primary key is allowed to have a
NULL value.
Column Constraints: During the data analysis phase, business rules will identify any
column constraints. For example, a salary cannot be negative; an employee number must
be in the range 1000 - 2000, etc.
User-Defined Integrity Constraints: Business rules may dictate that when a specific
action occurs, further actions should be triggered. For example, deletion of a record
automatically writes that record to an audit table.
Referential Integrity: It implies that if a foreign key is defined in one table, any of its
value must exist as a primary key in another table.
9
VIII) DATABASE MANAGEMENT SYSTEM
V.1 Definition
To carry out operations like insertion, deletion and retrieval, the database needs to be managed
by a software package. This software is called a database management system (DBMS).
Hence, DBMS can be defined as a collection of interrelated data and a set of programs to access
that data.
Database system: Database system is a general term that refers to the combination of a database,
a database management system and a data model. This system is responsible for the following
data manipulation acts; data controlling, data retrieving, data maintenance and data definition.
A good database management system (DBMS) should provide the following advantages over a
conventional system:
Normalisation is a process which we analyze and alter a database table in order to get more
concise and organized data structures. Another way of saying it, Normalization is the process of
taking data from a problem and reducing it to a set of tables while ensuring data integrity and
eliminating data redundancy. Normalization is therefore a method that removes redundancy
from a table thereby minimizing the insertion, deletion and update anomalies that degrade the
performance of databases.
Data integrity - all of the data in the database are consistent, and satisfy all integrity
constraints.
10
Data redundancy – if data in the database can be found in two different locations (direct
redundancy) or if data can be calculated from other other data items (indirect
redundancy) then the data is said to contain redundancy.
Normalised data is stable and has a natural structure. We call a table normalized if:
A table is in first normal form (1NF) if a relation cannot have repeating fields or groups (no
field must have more than one value): To set a table in 1NF, we have to:
a) Eliminate duplicative columns from the same table.
b) Create separate tables for each group of related data and identify each row with a
unique column or set of columns (the primary key).
Example1
The attribute Skills can contain multiple values and therefore the relation is not in the first
normal form.
11
VII.3 Second normal form (2NF)
Example
The attributes IDSt and IDProf are the identification keys. All attributes a single valued (1NF).
The table in this example is in first normal form (1NF) since all attributes are single valued. But
it is not yet in 2NF. If student 1 leaves university and the tuple is deleted, then we loose all
information about professor Schmid, since this attribute is fully functional dependent on the
primary key IDSt. To solve this problem, we must create a new table Professor with the attribute
Professor (the name) and the key IDProf. The third table Grade is necessary for combining the
two relations Student and Professor and to manage the grades. Besides the grade it contains only
12
the two IDs of the student and the professor. If now a student is deleted, we do not loose the
information about the professor.
A table is in third normal form (3NF) if it is in 2NF and there is no transitive dependency
that is an attribute depends on one or more other non-key attributes. We have to remove columns
that are not dependent upon the primary key.
Example
The attribute ID is the primary key. All attributes are single valued (1NF). The table is also in
2NF. The following dependencies exist:
The 3NF, which eliminates most of the anomalies known in databases today, is the most
common standard for normalization in commercial databases and CASE tools. The few
remaining anomalies can be eliminated by the Boyce-Codd normal form (BCNF) and higher
normal forms defined here and in Section 6.5. BCNF is considered to be a strong variation of
3NF.
13
A relation is in 4NF if it has no multi-valued dependencies. In practice we rarely need to apply
the 4NF to a database.
X) Data Modelling
Data modelling is the first step in the process of database design. This step is sometimes
considered to be a high-level and abstract design phase, also referred to as conceptual design.
The aim of this phase is to describe:
The data contained in the database (e.g., entities: students, lecturers, courses, subjects)
The relationships between data items (e.g., students are supervised by lecturers; lecturers
teach courses)
The constraints on data (e.g., student number has exactly eight digits; a subject has
four or six units of credit only)
In the second step, the data items, the relationships and the constraints are all expressed using the
concepts provided by the high-level data model. Because these concmepts do not include the
implementation details, the result of the data modelling process is a (semi) formal representation
of the database structure. This result is quite easy to understand so it is used as reference to make
sure that all the user’s requirements are met.
The third step is database design. During this step, we might have two sub-steps: one called
database logical design, which defines a database in a data model of a specific DBMS, and
another called database physical design, which defines the internal database storage structure,
file organization or indexing techniques. These two sub-steps are database implementation and
operations/user interfaces building steps.
In the database design phases, data are represented using a certain data model. The data model is
a collection of concepts or notations for describing data, data relationships, data semantics and
data constraints. Most data models also include a set of basic operations for manipulating data in
the database.
14
be placed, etc. The last step is to hire a contractor to build the home. That’s looking at the design
from a high level of abstraction to an increasing level of detail.
The database design is very much like that. It starts with users identifying the business rules;
then the database designers and analysts create the database design; and then the database
administrator implements the design using a DBMS.
Key considerations in organizing data in a database include determining what data to collect in the
database, who will have access to it, and how they might want to use the data. After determining these
details, an organization can create a database.
Building a database requires two different types of designs: a logical design and a physical design. The
logical design of a database is an abstract model of how the data should be structured and arranged to
meet an organization’s information needs. The logical design involves identifying relationships among
the data items and grouping them in an orderly fashion. Because databases provide both input and
output for information systems throughout a business, users from all functional areas should assist in
creating the logical design to ensure that their needs are identified and addressed. Physical design
starts from the logical database design and fine-tunes it for performance and cost considerations (such
as improved response time, reduced storage space, and lower operating cost).
For example, the logical database design might need to be altered so that certain data entities are
combined, summary totals are carried in the data records rather than calculated from elemental data,
and some data attributes are repeated in more than one data entity. These are examples of planned
data redundancy, which improves the system performance so that user reports or queries can be
created more quickly. The main tool used for the physical design is Normalization
One of the tools database designers use to show the logical relationships among data is a data model.
A data model is a diagram of entities and their relationships. Data modeling usually involves
understanding a specific business problem and analyzing the data and information needed to deliver a
solution. When done at the level of the entire organization, this is called enterprise data modeling.
Enterprise data modeling is an approach that starts by investigating the general data and information
needs of the organization at the strategic level, and then examines more specific data and information
needs for the various functional areas and departments within the organization. Various models have
been developed to help managers and database designers analyze data and information needs. An
entity-relationship diagram is an example of such a data model.
15
Entity-relationship (ER) diagrams use basic graphical symbols to show the organization of and
relationships between data. In most cases, boxes in ER diagrams indicate data items or entities
contained in data tables, and diamonds show relationships between data items and entities. In other
words, ER diagrams show data items in tables (entities) and the ways they are related. ER diagrams help
ensure that the relationships among the data entities in a database are correctly structured so that any
application programs developed are consistent with business operations and user needs. In addition, ER
diagrams can serve as reference documents after a database is in use. If changes are made to the
database, ER diagrams help design them.
Although there are a number of different database models, including flat files, hierarchical, and network
models, the relational model has become the most popular, and use of this model will continue to
increase. The relational model describes data using a standard tabular format. In a database structured
according to the relational model, all data elements are placed in two-dimensional tables, called
relations, which are the logical equivalent of files.
The tables in relational databases organize data in rows and columns, simplifying data access and
manipulation. It is normally easier for managers to understand the relational model (see Figure 5.5) than
other database models.
Database management systems can range from small, inexpensive software packages to sophisticated
systems costing hundreds of thousands of dollars. The following sections discuss a few popular
alternatives.
Flat File
A flat file is a simple database program whose records have no relationship to one another.
Flat file databases are often used to store and manipulate a single table or file, and do not use
any of the database models discussed previously, such as the relational model. Many spreadsheet and
word processing programs have flat file capabilities.
Single User
16
A database installed on a personal computer is typically meant for a single user. Microsoft Office Access
and FileMaker Pro are designed to support single-user implementations. Microsoft InfoPath is another
example of a database program that supports a single user. This software is part of the Microsoft Office
suite, and it helps people collect and organize information from a variety of sources.
Multiple Users
Small, midsize, and large businesses need multiuser DBMSs to share information throughout the
organization over a network. These more powerful, expensive systems allow dozens or hundreds of
people to access the same database system at the same time. Popular vendors for multiuser database
systems include Oracle, Microsoft, Sybase, and IBM. Many single-user databases, such as Microsoft
Access, can be implemented for multiuser support over a network, though they often are limited in the
amount of users they can support.
All DBMSs share some common functions, such as providing a user view, physically storing and
retrieving data in a database, allowing for database modification, manipulating data, and generating
reports. These DBMSs can handle the most complex data-processing tasks, and because they are
accessed over a network, one database can serve many locations around the world.
Database Administration
Database systems require a skilled DBA. A DBA is expected to have a clear understanding of the
fundamental business of the organization, be proficient in the use of selected database management
systems, and stay abreast of emerging technologies and new design approaches.
The role of the DBA is to plan, design, create, operate, secure, monitor, and maintain databases.
Typically, a DBA has a degree in computer science or management information systems and some on-
the-job training with a particular database product or more extensive experience with a range of
database products
Exercise 1.1
Why would you choose a database system instead of simply storing data in operating system files?
When would it make sense not to use a database system?
17
_______________.
a. GUI
b. operating system
c. DBMS
d. productivity software
d. productivity software
2. A(n) _______________ is a skilled and trained IS profes
sional who directs all activities related to an organization’s database.
3. Data redundancy is a desirable quality in a database. True or False?
4. A(n) _______________ is a field or set of fields that uniquely identifies a database record.
a. attribute
b. data item
c. key
d. primary key
5. A(n) _______________ uses basic graphical symbols to show the organization of and relationships
between data.
6. What database model places data in two-dimensional
tables?
a. relational
b. network
c. normalized
d. hierarchical
18
9. Because the DBMS is responsible for providing access to a database, one of the first steps in installing
and using a database involves telling the DBMS the logical and physical structure of the data and
relationships among the data in the database. This description of an entire database is called a(n) _____
REVIEW QUESTIONS
1. What is an attribute? How is it related to an entity?
19
2. Define the term database. How is it different from a database management system?
3. What is the hierarchy of data in a database?
4. What is a flat file?
5. What is the purpose of a primary key? How can it be useful in controlling data redundancy?
6. What is the purpose of data cleanup?
7. What are the advantages of the database approach?
8. What is data modeling? What is its purpose? Briefly describe three commonly used data models.
9. What is a database schema, and what is its purpose?
10. How can a data dictionary be useful to database administrators and DBMS software engineers?
11. Identify important characteristics in selecting a database management system.
12. What is the difference between a data definition language (DDL) and a data manipulation language
(DML)?
13. What is the difference between projecting and joining?
14. What is a distributed database system?
15. What is a data warehouse, and how is it different from a traditional database used to support OLTP?
16. What is meant by the “front end” and the “back end” of a DBMS?
18. What is an ORDBMS? What kind of data can it handle?
19. What is business intelligence? How is it used?
20. In what circumstances might a database administrator consider using an object-oriented database?
EXERCISE 2
i) What is a database?
ii) The manager of a supermarket decides to keep track of his customers
and their transactions in the supermarket. A customer is identified by the
name, an address, the city and the telephone number. An item is identified by
a name, the quality and the unit price, A customer can order one or more items
and an item can be ordered by one or many customer, since there is a certain
quantity of each item. For an item ordered, the date and quantity ordered is
stored.
a) Draw the Entity-Relation Diagram corresponding to the above
situation and precise the different cardinalities.
b) Deduce the relational model from the Entity-Relation Diagram. The
primary key of each relation should be underlined.
iii) A relation NADDR is defined as follows. NADDR=(name, street, city,
state, postal code)where name is unique. And for any given postal code, there
is just one city and state.
a) What is normalization?
b) Is NADDR in 2NF? Explain why.
20
NADDR is not in 3NF, normalize it into 3NF relation
EXERCISE 3
Exercise 3 (10 marks)
1) Explain the following terms briefly: (6marks)
i. Data
ii. Database,
iii. database Table
iv. Database Query
v. SQL, Flat file Database
vi. Relational database
vii. Normalization
viii. Data integrity
ix. Computerized and non-computerized database ( given two examples in each case
2) When is a table said to be in each of the following Normal Form (4 marks)
a) 1NF
b) 2NF
c) 3NF
Exercise 4 (15 marks)
A bakery accepts catering orders from customers. Most of them are regular
customers and each one is given an ID number. A CUSTOMER is issued
an invoice when he places an ORDER, which indicates each PRODUCT
that the customer has ordered and the date that he can pick up his
products. At the order taking counter the bakery displays a list of
products that it produces.
Details of the order are to be stored in a database using the following four
tables:
21
(iii) Write a Data Definition Language (DDL) statement to create the
Customer table, including the key field. (3 marks)
(iv) The company wants to send letters to customers to advertise a new
product. The letters must be sent to all customers. A customer’s
ID, name and telephone number must be included in each letter.
Write a SQL query that will find the data needed to produce the
letters. (4 marks)
(v) The customer named ‘Atangana Paul’ is to be renamed ‘Atanga
Paul’. Write a SQL statement to update the data in the customer
table to reflect this change.(4 marks)
22
C. Write an SQL query to create any two tables of the database(4 marks)
Exercise 5
A company database needs to store information about employees (identifiedbyssn,withsalary and
phone as attributes), departments (identified by dno, with dname and budget as attributes), and
children of employees (with name and age as attributes). Employees work in departments; each
department is managed by an employee; a child must be identified uniquely by name when the
parent (who is an employee; assume that only one parent works for the company) is known. We
are not interested in information about a child once the parent leaves the company.
EXERCISE 4
1. You have been selected to represent the student body on a project to develop a new student
database for your school. What actions might you take to fulfill this responsibility to ensure that the
project meets the needs of students and is successful?
4. Make a list of the databases in which data about you exists. How is the data in each database
captured? Who updates each database and how often? Is it possible for you to request a printout of the
contents of your data record from each database? What data privacy concerns do you have?
5. Assume that you are the database administrator for a corporation with a large database. What steps
would you implement to help prevent people from stealing personal information from the corporate
database?
3. A video movie rental store is using a relational database to store information on movie rentals to
answer customer questions. Each entry in the database contains the following items: Movie ID No.
(primary key), Movie Title, Year Made, Movie Type, Number of Copies on Hand, and Quantity Owned.
Movie types are comedy, family, drama, horror, science fiction, and western. MPAA
ratings are G, PG, PG-13, R, NC-17, and NR (not rated).
Use a single-user database management system to build a data-entry screen to enter this data. Build a
small database with at least ten entries.
3. To improve service to their customers, the salespeople at the video rental store have proposed a list
of changes being considered for the database in the previous exercise. From this list, choose two
database modifications and modify the data-entry screen to capture and store this new information.
Proposed changes:
23
a. Add the date that the movie was first available to help locate the newest releases.
b. Add the director’s name.
c. Add the names of three primary actors in the movie.
d. Add a rating of one, two, three, or four stars.
e. Add the number of Academy Award nominations.
4. Your school maintains information about students in several interconnected database files. The
student_contact file contains student contact information. The student_grades file contains student
grade records, and the student_financial file contains financial records including tuition and
student loans. Draw a diagram of the fields these three files might contain, which field is a primary key
in each file, and which fields serve to relate one file to another.
Exercise 5 Explain the following terms briefly: attribute, domain, entity, relationship, entity , one-to-
many relationship, many-to-many relationship, participation constraint, overlap constraint, covering
constraint.
Exercise 6 university database contains information about professors (identified by social security
number, or SSN) and courses (identified by courseid). Professors teach courses For each situation, draw
an ER diagram that describes it).
1. Professors can teach the same course in several semesters, and each offering must be recorded.
2. Professors can teach the same course in several semesters, and only the most recent such offering
needs to be recorded.
Exercise 7 Consider the following information about a university database: Professors have an SSN, a
name, an age, a rank, and a research specialty.
Projects have a project number, a sponsor name (e.g., NSF), a starting date, an ending date, and a
budget. Graduate students have an SSN, a name, an age, and a degree program (e.g., M.S. or Ph.D.).
Each project is managed by one professor (known as the project’s principal invest tigator).
Each project is worked on by one or more professors (known as the project’s co-investigators).
Professors can manage and/or work on multiple projects.
Each project is worked on by one or more graduate students (known as the project’s research
assistants).
24
When graduate students work on a project, a professor must supervise their work on the project.
Graduate students can work on multiple projects, in which case they will have a (potentially different)
supervisor for each one.
Departments have a department number, a department name, and a main office.
Departments have a professor (known as the chairman) who runs the department.
Professors work in one or more departments, and for each department that they work in, a time
percentage is associated with their job.
Graduate students have one major department in which they are working on their degree.
Each graduate student has another, more senior graduate student (known as a student advisor) who
advises him or her on what courses to take.
Design and draw an ER diagram that captures the information about the university.
Use only the basic ER model here; that is, entities, relationships, and attributes. Be sure to indicate any
key and participation constraints.
25