Oracle
Section 1
Introduction to Databases
What is the difference between data and information?
Data: collected facts about a topic or item
Information: the result of combining, comparing, and performing calculations on data
Database Definition
A database:
• Is a centralized and structured set of data stored on a computer system.
• Provides facilities for retrieving, adding, modifying, and deleting the data when required.
• Provides facilities for transforming retrieved data into useful information.
Relational Databases
A relational database stores information in tables with rows and columns.
➢ A table is a collection of records.
➢ A row is called a record (or instance).
➢ A column is referred to as a field (or attribute).
1
,Database Management System
A DBMS is software that controls the storage, organization, and retrieval of data.
Key Computing Terms
In the field of computing, these are some of the key terms:
• Hardware : physical parts of a computer
• Software : instructions to tell hardware what to do
• Operating system : software that directly controls the hardware
• Application : performs specific task
• Client : workstation used by end users
• Server : accepts work requiring more power from clients
Transformation in Computing
There have been so many changes in the field of computing. What were they and when did they occur?
1970s: Mainframe Computing (Centralized Processing)
▪ In the 1970s, attempts were made to build database systems with integrated hardware and
software.
▪ Smaller computers, or "dumb terminals," were used to access the large mainframe and execute
commands.
▪ The terminals depended on the mainframe and displayed the results only after the processing
was completed in the mainframe.
▪ They were not capable of much processing on their own.
2
,1980s: Desktop Computing (Localized Processing)
▪ As PCs became faster and widely available, processing moved from mainframes to clients.
▪ PCs had their own software and were capable of doing some processing on their own, they came
to be known as "smart clients" or "workstations.“
▪ Having the processing power within the client machine ushered in a wave of graphical user
interface (GUI) applications. Many of today’s common applications (Word, Excel, PowerPoint)
were created during this era.
1990s: Client/Server Computing (Centalized and Local Processing)
▪ Client/Server computing uses the Internet and fast processing servers to meet the needs of
organizations in storing data and producing information.
▪ The software that manages the data is on the database server, it performs processing for storage
and retrieval.
▪ Applications for business operations sit on the application server, it performs processing for
document creation, developing, interacting, or manipulating the data.
▪ Clients can have applications of their own, but the essential business applications are accessed
from the clients by using an Internet browser.
2000s: Grid Computing (Shared Processing)
▪ In the grid-computing model, all of an organization's computers in different locations can be
utilized just like a pool of computing resources.
▪ Grid computing builds a software infrastructure that can run on a large number of networked
servers.
▪ A user makes a request for information or computation from his or her workstation and that
request is processed somewhere in the grid as efficiently as possible.
2010s: Cloud Computing (Internet Based Processing)
▪ Cloud computing allows the delivery of computing services over the Internet.
▪ The three main categories of cloud services are:
o IaaS – Allows you to rent cloud based servers, storage, operating systems etc.
o PaaS – Gives access to an online environment for developing and testing software
without any setup or management costs.
o SaaS – Delivers software direct from the Internet. Users normally access it through a web
browser.
Types of Database Models
Database Development Process
3
,Types of Database Models
Flat File Model
▪ A flat file database is a database designed around a single table
▪ Flat file databases are generally in plain-text form, where each line holds only one record.
▪ The fields in the record are separated with delimiters, such as tabs and commas.
Example: Books as well as Authors are stored in this single table, causing repetition of data values
Hierarchical Model
▪ In a hierarchical database model, the data is organized in a tree-like structure.
▪ The data is stored as records that are connected to one another through links.
▪ A record is a collection of fields.
▪ A record in the hierarchical database model corresponds to a row in the relational database
model
Example: Data is organized in a tree-like structure and stored as records that are connected to one
another through links.
Network Model
▪ The network model is a database model that can be regarded as a flexible way of representing
objects and their relationships.
▪ A network database comprised of a collection of records connected to one another through links.
(Boxes = Fields, Lines = Links)
▪ Each record is a collection of fields, each of which contains only one data value.
▪ A link is an association between two records.
4
,Example: Oliver Blake holds accounts in two banks, BNK001 and BNK005. Leo Smith holds accounts in
three banks, BNK005, BNK007, BNK009.
Object-Oriented Model
▪ A entity is modeled as an object.
▪ Every object has a state (the set of values for the attributes of the object) and a behavior (the set
of methods that operate on the state of the object).
▪ The relationship between the objects is through sharing of access
▪ An object must belong to only one class as an instance of that class.
▪ You can derive a new class (subclass) from an existing class (superclass).
Example: Shown are two Employee objects created from the Employee class. Each with different values
for the attributes of id and lastName.
Relational Model
▪ Data is represented as a collection of tables.
▪ Each column represents attributes that belong to the table.
▪ Each row represents an instance of the table.
▪ Each table is the visual representation of columns and rows.
▪ Every table has a field or a set of fields that uniquely identifies the row.
▪ The order of the rows and columns is not important.
▪ Every row is unique.
▪ Each field can contain only one value.
▪ Values within a column or field are from the same domain (datatype)
▪ Table names must be unique
▪ Column names within each table must be unique.
5
,Example: In this example a relationship is created between the two tables using the common field of
DEPARTMENT_ID
Business Requirements
Why Do I Need a Database Solution?
▪ Multiple Users
▪ Integration of Multiple Components
▪ Multiple Data Items
Need a Database Solution for:
This is a flat file that stores information about students, the sports that they selected, and the price for
each sport that they selected. This scenario warrants the need for a relational database.
Flat file was split into three tables eliminating issues related to: Redundancy, Data entry anomalies,
Inconsistency
6
,Importance of Business Rules
It is important to identify and document business rules when designing a database.
Business rules:
▪ Allow the developer/architect to understand the relationship and constraints of the participating
entities
▪ Help you understand the standardization procedure that an organization follows when handling
huge data
▪ Should be simple and easy to understand
▪ Must be kept up-to-date
▪ Business rules are used to understand business processes and the nature, role, and scope of the
data.
▪ Business rules help you categorize and design database tables.
▪ Business rules are generally provided by:
o Managers
o Policy makers
o Documentation and operation manuals
o Organizational procedures and standards
o Interviews with end users
A conceptual model is important to a business because it:
▪ Describes exactly the information needs of the business
▪ Facilitates discussion
▪ Prevents mistakes and misunderstandings
▪ Forms important “ideal system” documentation
▪ Forms a sound basis for physical database design
▪ Documents the processes (also known as the “business rules”) of the business
▪ Takes into account regulations and laws governing this industry
▪ Note: Not all business rules can be modeled in a database.
Identifying Key Business Rules, Problems, and Assumptions
Business rule: Used to understand business processes and the nature, role, and scope of the data.
Assumption: Can be defined as a fact or a statement that has been taken for granted.
Problem: Can be defined as a situation or scenario that requires attention and a possible solution to
alleviate the situation.
7
,Section 2
Relational Databases
Single Table
As discussed previously, a flat file database is a type of database that stores data in a single table. Flat file
databases are generally in plain-text form, where each line holds only one record.
Relational Databases
▪ A relational database presents information in tables with rows and columns.
▪ Each column represents a particular type of information (a field), and each row lists one record.
▪ The tables are then related to one another by using a common field.
▪ A unique field called a key is used to identify each record in a relational database.
Advantages of a Relational (Multiple-Table) Database: Less redundancy, Avoidance of inconsistency,
Efficiency, Data integrity, Confidentiality
8
,Rules for Relational Database Tables
▪ Each table has a distinct name.
▪ Each table may contain multiple rows.
▪ Each table has a value to uniquely identify the rows.
▪ Each column in a table has a unique name.
▪ Entries in columns are single values.
▪ Entries in columns are of the same kind.
▪ Order of rows and columns is insignificant.
Key Terms
▪ Table: A basic storage structure
▪ Column – attribute that describes the information in the table
▪ Primary Key – the unique identifier for each row
▪ Foreign Key – a column that refers to a primary key column in another table
▪ Row – data for one table instance
▪ Field – the one value found at the intersection of a row and column
Conceptual and Physical Data Models
Conceptual Model
➢ Captures the functional and informational needs of a business.
➢ Is based on current needs, but may reflect future needs.
➢ Addresses the needs of a business (what is conceptually ideal), but does not address its
implementation (what is physically possible).
A conceptual model
▪ Identifies :
o important entities (objects that become tables in database)
o relationships among entities
▪ Does not specify :
o attributes (objects that become columns or fields in database)
o unique identifiers (attribute that becomes primary key in database)
Logical Model
▪ Includes all entities and relationships among them
▪ Is called an entity relationship model (ERM)
▪ Is illustrated in an ERD
▪ Specifies all attributes and UIDs for each entity
▪ Determines attribute optionality
▪ Determines relationship optionality and cardinality *
9
, Physical Model
▪ Is an extension to a logical data model
o Defines table definitions, data types, and precision
o Identifies views, indexes, and other database objects *
▪ Describes how the objects should be implemented in specific database
▪ Shows all table structures, including columns, primary keys, and foreign keys
Steps to Create a Physical Data Model
Conceptual and Physical Models
▪ The art of planning, developing, and communicating produces a desired outcome
▪ Data modeling is the process of capturing the important concepts and rules that shape a business
and depicting them visually in a diagram
▪ This diagram becomes the blueprint for designing the physical thing
▪ The client's dream (conceptual model) becomes a physical reality (physical model)
Conceptual/Logical Model: Case Scenario
Faculty: Matt, I would like you to create a simplified library database to store the book details in our
department
Matt: Sure. I will start by identifying the entities and attributes and their relationships
1. A Conceptual data model documents important entities and how they relate to each other
10