Design A Database TTLM LO1
Design A Database TTLM LO1
Ethiopian TVET-System
INFORMATION TECHNOLOGY
DATABASE ADMINISTRATION
LEVEL III
LEARNING GUIDE # 09
Unit of Competence:Design a Database
Module Title : Designing a Database
LG Code : ICT DBA3 M03 09
TTLM Code :ICT DBA3 TTLM 0817
Learning Outcomes (LO) Page
Establishing Relationships
Before determining data relationships, it is important to identify all data first. Relationships allow one or
more entities to be related. Without the ability to relate data among entities, all data and fields would be
required to reside in a single entity, which means that the amount of redundant information stored will be
maximized. Relationships determine how data from one entity can be associated with another entity.
Relationships also determine how data from one entity can refer to (access) data in another entity. In order
for relationships to exist between entities, entities must have fields that are common to one another.
Although many entities that have been identified will not have direct relationships to other entities, all
entities should be related to at least one other entity, creating an indirect relationship between entities.
For example, consider the following entities and brief lists of fields:
· Class schedule (class, date, location, instructor)
· Registration (class, student)
· Instructors (instructor, address, pay rate)
· Students (student, address)
Instructors are associated with classes, classes are associated with registration, and students are associated
with registration. Instructors and students are not associated with one another directly, but one can easily
determine the students who are taught by a particular instructor by finding out what classes an instructor
teaches, and then by finding out what students are registered for the classes taught by the instructor.
Relationships such as these are typical in a relational database. This scenario represents two types of
relationships found in a relational database: one-to-many and many-to-many relationships. A one-to-one
relationship does not exist in this scenario.
The following one-to-many relationships exist:
o Class schedules are associated with many registrations.
o A student might have registered for many classes.
The following many-to-many relationships exist:
Instructors can teach more than one class, and a class can be taught by more than one
instructor.
An instructor can teach many students, and a student can have many instructors.
Business rules affect the relationships that might exist between data. Consider the following business
rules:
A class might be scheduled many times throughout the year.
A class must have a lead instructor.
An instructor must teach at least one class.
Many students can register for a class that has been scheduled.
A class might have an assistant instructor, depending on the student enrollment.
No more than 15 students can register for a given class.
A class will be canceled if less than 5 students are enrolled for a given class.
The first five business rules determine data relationships. The fifth business rule also affects the logic in the
user application. The last two business rules do not affect the design of the database or the data
relationships, but affect the design of the user application that accesses the data. Take time to compare the
business rules with the sample relationships discussed.
Determining the Direction of Database Design
At some point toward the end of information gathering and requirements analysis, the direction taken for
the remainder of database design must be taken into consideration. Currently, all business requirements
should be defined.
In review, these business requirements include the data (entities and lists of fields), business rules, and
business processes. Interviews have been conducted with the customer and end user, as well as
management. Diagrams have been drawn to depict the business information gathered. These diagrams are
used to enhance the development team’s understanding of the business so that a database can be accurately
designed. These diagrams are also used to conduct user feedback sessions, to obtain approval for the work
accomplished from all appropriate parties. Back and forth, this process goes, until everyone is satisfied that
all business requirements are completely gathered for the proposed database. After all information has been
gathered, it is simply a process of putting the pieces together.
Imagine putting a puzzle together, only to find out after hours of work that a piece has been missing all
along.
Following are considerations in determining the direction of any database design effort after information
has been gathered. These considerations can be taken before interviews are conducted; just be aware that
database design cannot proceed until the following issues are resolved.
Database model to be used
Implementation to be used
Establishment of naming conventions and standards
Establishment of milestones and deliverables
Assign roles to members of design team
Determining the Type of Database Model
Hopefully at this point, a database model has already been selected. In most cases in today’s world, the
choice will be the relational database model. The model that best suits the needs of the business must be
selected. As previously mentioned, this book is based on the concepts of designing a database to fit the
mold of the relational database.
It is very unlikely that the flat-file database, network model, or hierarchical model will be the best choice
for an organization. As time passes, more companies will be paralleling their strategy for storing data with
object-oriented (OO) and object-relational (OR) technologies. In our opinion, the transition most
companies will take toward OO and OR databases will not happen for several years, during which time
these new technologies will have applied standards, have been tested more thoroughly, and have had more
successful real-world implementations.
Selecting an Implementation
It is easy to select a database model. After a database model has been selected, an implementation must be
selected. If the relational database model is being used, a relational database management system
(RDBMS) must be selected.
If you are not familiar with any particular RDBMS, making a selection can be very difficult at first because
so many relational database vendors exist.
Some common relational database management systems include
Oracle—Commonly used by medium- to large-sized organizations (mainframe, client/server, Internet)
Microsoft SQL Server—Commonly used by medium- to large-sized organizations (client/server)
Microsoft Access—Commonly used by smaller organizations for personal applications (personal)
DB2—Commonly used by small- to large-sized organizations (mainframe, client/server, Internet)
Informix—Commonly used by small- to large-sized organizations (mainframe, client/server, internet)
Sybase—Commonly used by small- to large-sized organizations (mainframe, client/server, internet)
MySQL—Commonly used by small- to large-sized organizations (mainframe, client/server, internet)
Setting Naming Conventions and Standards to Be Used
Naming conventions and development standards are not so important during information gathering, but
must be established before beginning to model and design the database. Consider the following when
establishing naming conventions and standards.
How will entities be named?
How will attributes be named?
How will tables be named?
How will columns be named?
How will other database objects be named?
What abbreviations will be used?
Common sense should prevail when naming any database related object. All names should be descriptive.
At this point in the design process, avoid using abbreviations that might make a name obscure. If
abbreviations are used, an approved abbreviation list should be created.
Entities and attributes should have long, descriptive names. Remember that the main focal point of
information gathering and requirements analysis is understanding the business.
When business objects are converted into database objects, it may be more important to abbreviate names
to simplify code and meet the storage requirements of the RDBMS. For example, some RDBMSs restrict
the length of a database object name to thirty characters. Also, it is a common rule that database object
names cannot contain any spaces, although an underscore can be used to achieve the same effect. An
example is EMPLOYEE PAY (entity name) becomes EMPLOYEE_PAY (table name).
Following are sample rules we like to use when naming database related objects:
The name should be in singular form (CUSTOMER).
The name should contain spaces if more than one word for entities, and should
contain underscores in the
place of spaces for tables.
Names should be capitalized.
Identifiers use the word ID.
If abbreviations are used, be consistent.
Don’t prefix column names with the table name, or abbreviation for the table name
(for the department
name, use NAME, not DNAME).
It is important that naming conventions are established, followed, and enforced for consistency throughout
the design and life of a database. Adherence to naming conventions promote ease in the development of the
database, the application, and the management of an existing database. Defining and enforcing naming
conventions is one of an organization’s first steps towards a successful database implementation.
Summary
After all requirements are gathered, the design team draws various diagrams which depict the data and
processes that belong to the business. The most typical diagrams, which are quite vague at this point,
include entity relationship diagrams (illustrate the data), process model diagrams, function hierarchy
diagrams, and data flow diagrams. Detail is added to diagrams when converting business requirements into
system requirements. For example, after a list of fields are determined for a given entity; attributes are
added to the entity on the ERD. System requirements are defined by identifying the data, breaking the data
into logical groups, creating a list of fields for groups of data, and establishing data relationships. Before
information gathering and requirements analysis are complete, and the next major phase, modeling, is
encountered, precautions must be taken to ensure that the project is moving on the right track. Before
modeling begins, standards and naming conventions must be established so that all work is performed
consistently.