Professional Documents
Culture Documents
bit (0/1, true/false, on/off)-> byte (8 bits) -> field -> record -> file (table) -> database
Table
Primary Key: One of more fields that identify a record uniquely.
Referential Integrity
How are tables connected in a relational database? Entity Relationship Diagram (ERD) using Crow's Foot
Notation.
A one-to-one (1:1) relationship is when at most one instance of an entity A is associated with
one instance of entity B. For example, take the relationship between board members and
offices, where each office is held by one member and no member may hold more than one
office.
A one-to-many (1:N) relationship is when for one instance of entity A, there are zero, one, or
many instances of entity B but for one instance of entity B, there is only one instance of entity
A. An example of a 1:N relationships is
A many-to-many (M:N) relationship, sometimes called non-specific, is when for one instance
of entity A, there are zero, one, or many instances of entity B and for one instance of entity B
there are zero, one, or many instances of entity A. An example is employees may be assigned
to no more than three projects at a time; every project has at least two employees assigned to
it.
Database model (ERD) Actual/Real Database (e.g. in Access)
ERD Exercise 2
Draw E-R diagrams showing the cardinality for the following:
a) An invoice is sent to one customer, and many invoices can be sent to the same
customer
b) A part is used in many projects, and many projects use the part
c) A person works in one department, and there are many persons in a department.
d) A vehicle is owned by one person, and a person can own many vehicles.
e) Students take subjects. Each subject can be taken by many students, and each
student can take many subjects
f) Persons apply for loans. Each loan must be made to one person, but each person can
make many applications.
g) An operator can work on many machines, and each machine has many operators.
Each machine belongs to one department, but a department can have many machines.
ERD Exercise 3
Pick and Shovel Construction Company is a multi-state building
contractor specializing in medium-priced town homes. A customer
can hire the company for more than one project, and employees
sometimes work on more than one project at a time. Equipment,
however, is assigned to only one project at a time.
ERD Exercise 4
Each of the MegaCo Corporation’s divisions is composed of many
departments. Each of the departments has many employees
assigned to it, but each employee works for only one department.
Each department is managed by one employee, and each of these
managers can manage only one department at a time.
ERD Exercise 5
The KwikTite Corporation operates many factories. Each factory is
located in a region. Each region can be "home" to many of KwikTite’s
factories. Each factory employs many employees, but each of these
employees is employed by only one factory. An employee may have
earned many degrees, and each degree may have been earned by
many employees.
join table or intersection relation (intersect table)