Professional Documents
Culture Documents
SPECIAL TRAINING
SESSION OBJECTIVE
This session will introduce you to the basic concepts and terminologies used in Relational Analysis and Design.
What is a Database ?
A shared collection of logically related data (and a description of this data) designed to meet the information needs of an organization.
Database
What is a DBMS ?
A database management system (DBMS) is a software system that enables users to define, create and maintain the database and which provides controlled access to this database.
What is a Table ?
A table is a 2-dimensional representation of data consisting of one or more columns, and zero or more rows.
Example
COURSE
COURSE CODE BSCS BSIT BSA BSC COURSE DESCRIPTION COMPUTER SCIENCE INFORMATION TECHNOLOGY ACCOUNTANCY COMMERCE
The name of the table is COURSE. It has two columns and four rows. The column names are Course Code and Course Description.
Example
COURSE
COURSE CODE BSCS BSIT BSA BSC COURSE DESCRIPTION COMPUTER SCIENCE INFORMATION TECHNOLOGY ACCOUNTANCY COMMERCE
STUDENT
STUDENT STUDENT NUMBER NAME 01 02 03 04 HERBERT CARMEL NICOLAI GENE COURSE CODE YEAR TUITION BSCS BSCS BSA BSIT 1 2 4 4 7,000.00 6,500.00 5,000.00 8,000.00
Null Values
Example on Nulls
COURSE COURSE CODE NN BSCS BSIT BSA COURSE DESCRIPTION NN COMPUTER SCIENCE INFORMATION TECHNOLOGY ACCOUNTANCY
STUDENT STUDENT STUDENT NUMBER NAME NN 01 02 03 NN HERBERT CARMEL NICOLAI BSCS BSCS 1 2 4 7,000.00 5,000.00 COURSE CODE YEAR TUITION
Duplicate Values
When a value in a column matches exactly another value in the same column, it is called a duplicate value. ND means no duplicates allowed.
Duplicate rows are not allowed. However, duplicate values in particular columns of a table are not at all uncommon. By placing ND below a column heading, it will prohibit duplicate values in that column. To prevent duplicate values in groups of columns, suffix ND with a number, e.g. ND1, ND2, ND3, etc.
COURSE COURSE CODE NN, ND BSCS BSIT BSA COURSE DESCRIPTION NN, ND COMPUTER SCIENCE INFORMATION TECHNOLOGY ACCOUNTANCY
STUDENT STUDENT STUDENT NUMBER NAME NN, ND 01 02 03 NN, ND1 HERBERT CARMEL NICOLAI COURSE CODE YEAR TUITION ND1 BSCS BSCS 1 2 4 7,000.00 5,000.00
Changeable Values
A value in a table that may vary over time is called a changeable value. NC means no changes allowed.
Can student numbers in a table be changed? Place NC below the column heading to prevent changes on the values in that column.
COURSE COURSE CODE NN,ND,NC BSCS BSIT BSA COURSE DESCRIPTION NN, ND COMPUTER SCIENCE INFORMATION TECHNOLOGY ACCOUNTANCY
STUDENT STUDENT NUMBER NN,ND,NC 01 02 03 STUDENT NAME NN, ND1 HERBERT CARMEL NICOLAI COURSE CODE YEAR TUITION ND1 BSCS BSCS 1 2 4 7,000.00 5,000.00
Primary keys do not influence column order. Primary keys do not influence row order. Primary keys do not influence row access.
Database Concepts and Definition of Terms Other Primary Keys Notations system-assigned SA means
Mark a column with SA, in addition to PK if the values are automatically generated by the system.
UA means user-assigned
Mark a column with UA, in addition to PK, if the values of the primary key are assigned by the user.
COURSE COURSE CODE PK, UA BSCS BSIT BSA COURSE DESCRIPTION NN, ND COMPUTER SCIENCE INFORMATION TECHNOLOGY ACCOUNTANCY
Foreign key values might be null. Foreign key columns can contain duplicate values.
Derivative Data
Data that is calculated from data defined elsewhere in a model is called derivative data. DD means derivative data. DD is redundant data.
Derivative data should only be included in a model when severe performance problems dictate its necessity.
The Student Count column of the Course table is a derived data; the values in this column are calculated from the information resident in the Student table.
SESSION OBJECTIVE
This session will introduce you to the steps, procedures and rules used in basic relational analysis and design.
What is an Entity ?
An entity is a distinct object (a person, place or thing, concept or event) in the organization that is to be represented in the database.
Concentrate on nouns
More often, entities are obvious physical objects. Sometimes, they are nothing more than a concept or idea.
System-assign if necessary
The proposed primary key values should preferably be systemassigned. If no key exists, assign a code or number column as the primary key of the entity.
COURSE
COURSE NUMBER PK, UA BSCS BSIT BSA
STUDENT
STUDENT NUMBER PK, SA 01 02 03
STORE
STORE CODE PK, SA 1 2 3
ITEM
ITEM CODE PK, UA 456DFG1 264SG45 3FGH4D
CITY
CITY CODE PK, UA CBU MLA DVO
AREA
AREA CODE PK, UA S W E
CUSTOMER
CUSTOMER CODE PK, UA C451 C342 C343
CLASS
CLASS CODE PK, UA B G H
What is a Relation ?
A mode of being, an association, an action or an event that connects two or more entities together is called a relation.
Types of Relations
One-to-One Relations
Each occurrence of one entity can be related to zero or one, but no more than one occurrence of another entity.
One-to-Many Relations
Each occurrence of one entity, say X, can be related to zero, one or more occurrences of another entity, say Y; but Y can be related to zero or one, but no more than one occurrence of X.
Many-to-Many Relations
Each occurrence of one entity, say X, can be related to zero, one or more occurrences of another entity, say Y and vice-versa.
One-to-many relation
Place the foreign key, allowing duplicates (FK) into the table on the YES side of the relation.
Many-to-many relation
Draw a new table with a multi-column primary key consisting of two single-column foreign key.
One-to-one Situation
In a taxi-service company, each driver is assigned to one and only one unit. On the other hand, each unit is also assigned to one and only one driver. DRIVER Driver Number PK,UA D1 D2 D3 UNIT Unit Number PK,UA T201 T202 Driver Number FK,ND D1 D3
The relation is placed on the unit side since there are fewer units than drivers.
One-to-many Situation
A student is allowed to take only one course. However, there could be more than one student enrolled in each of the courses. COURSE Course Number PK,UA BSIT BSCS BSA STUDENT Student Number PK,UA S01 S02 S03 Course Number FK, NN BSIT BSIT BSCS
The relation is placed on the student entity being in the YES side of the relation.
Many-to-many Situation
STUDENT Student Number PK,UA S01 S02 S03 STUDENT/SUBJECT Subject Student Code Number PK,FK PK,FK CS11 S01 CS12 S01 CS11 S02
A new table is created to implement the many-to-many relation.
M:M
STORE
1:M 1:1
STAFF
CITY
ITEM
What is an Attribute ?
A qualifier of an entity or a relation describing its character, quantity, degree or extent is called an attribute.
Normalization Process
SPECIAL TRAINING
SESSION OBJECTIVE
This session will introduce you to the the process of normalization. It will present the purpose of normalization and will teach you how to define normal forms for tables and how to undertake the normalization process.
To insert the details of new students in Student_Course table, we must include the details of the courses at which the students are enrolled.
For example, to insert the details of new BSIT student, we must enter the correct details of the BSIT course so that the course details are consistent with values for BSIT in other rows of the Student_Course table.
To insert the details of a new course that currently has no enrolled students into the Student_Course table, it is necessary to enter nulls into the attributes for students such as Student Number.
However, the Student Number is the primary key for the Student_Course table, attempting to enter nulls for Student Number violates entity integrity.
If we delete a student row from the Student_Course table that represents that last student enrolled in a particular course, the information about that course is also lost from the database.
For example, if we delete the row for student number 02 (Carmel), the information relating to BSIT course is lost from the database.
If we want to change the value of one of the attributes of a particular course, for example the course description for BSIT, we must update the rows of all students enrolled in BSIT.
If this modification is not carried our on all the appropriate rows of the Student_Course table, the database will become inconsistent.
Repeating Groups
SPECIAL TRAINING