Professional Documents
Culture Documents
Example of information
Database approach
Database system – is a computer based system used to record and maintain
information. The information concerned can be anything of significance to the
organisation for whose use it is intended.
Database can hold different types of data, to make things straight forward,
database contents are divided up into two concepts:
Schema – Structure of Data, it defines how data is organized and how the relations
among them are related.
Data – These are facts.
Imagine a case where we want to store facts about employees in a company. Such
facts could include name, address, date of birth, and salary, these are all related so
they represent some particular customer.
In a database all this information will be held in single storage container called a
table. We can call this table an Employee table.
Employee Table
Name Surname Address Date of Birth Salary
From this table, the schema would define that Employee table has 5 components.
NAME,SURNAME,ADDRESS,DATE OF BIRTH AND SALARY.
As a database designer, you can name the column any name but it is much better
make them meaningful because it helps. Date of birth cannot be stored in name
column. We must avoid these types of errors in databases.
From what we know about the facts, we can say things like:
NAME is a string and needs to hold at least 12 characters.
ADDRESS is a string and needs to hold at least 12 Characters
DOB is a date; the company forbids people over 100 years old or younger than
18 years old working for them.
SALARY is a number. It must be greater than 0
These rules are enforced by a database designer.
Database users
Database users are the one who really use and take the benefits of database.
There will be different types of users depending on their need and way of
accessing the database.
Application Programmers – They are the developers who interact with the database
by means of DML queries. These DML queries are written in the application programs
like C, C++, JAVA, Pascal etc.
Sophisticated Users(End-user) – They are database developers, who write SQL
queries to select/insert/delete/update data. They do not use any application or
programs to request the database. They directly interact with the database by means
of query language like SQL
Database Admin – responsible for installing and maintaining DBMS
Database architecture
DBMS architecture helps in design, development, implementation, and maintenance of
a database.
A database stores critical information for a business. Selecting the correct Database
Architecture helps in quick and secure access to data.
1 tier architecture
The simplest Database Architecture is 1 tier where the Client, Server, and Database all
reside on the same machine.
Anytime you install a DB in your system and access it to practice SQL queries it is 1 tier
architecture. But such architecture is rarely used in production.
2 tier architecture
In the above diagram we can see that one server is connected with clients 1, 2 and 3. This
architecture provides Direct and faster communication.
3 tier architecture
3-tier schema is an extension of the 2-tier architecture. 3-tier architecture
has following layers.
Presentation layer (your PC, Tablet, Mobile, etc.)
Application layer (server)
Database Server
3 tier architecture contains an Application layer between the user and the
DBMS, which is responsible for communicating the user's request to the DBMS
system and send the response from the DBMS to the user.
The application layer(business logic layer) also processes functional logic,
constraint, and rules before passing data to the user or down to the DBMS
Three tier architecture is the most popular DBMS architecture.
The 3 architectures in detail
Presentation layer/User layer is the layer where user uses the database. He
does not have any knowledge about underlying database. He simply
interacts with the database as though he has all data in front of him.
You can imagine this layer as a registration form where you will be inputting
your details. Did you ever guessed, after pressing ‘submit’ button where the
data goes? No right? You just know that your details are saved. This is the
presentation layer where all the details from the user are taken, sent to the
next layer for processing.
Application layer is the underlying program which is responsible for saving
the details that you have entered and retrieving your details to show up in
the page.
This layer has all the business logics like validation, calculations and
manipulations of data, and then sends the requests to database to get the actual
data. If this layer sees that the request is invalid, it sends back the message
to presentation layer. It will not hit the database layer at all.
Database layer is the layer where actual database resides. In this layer, all
the tables, their mappings and the actual data present.
When you save your details from the front end, it will be inserted into the
respective tables in the database layer, by using the programs in the
application layer.
When you want to view your details in the web browser, a request is sent to
database layer by application layer.
The database layer fires queries and gets the data. These data are then
transferred to the browser (presentation layer) by the programs in the
application layer.
Data abstraction
An external schema describes the part of the database which specific user is
interested in. It hides the unrelated details of the database from the user.
An external view is just the content of the database as it is seen by some
specific particular user.
For example, a user from the sales department will see only sales related
data.
Database management system
A database management system (DBMS) is a software package designed to
define, manipulate, retrieve and manage data in a database. A DBMS
generally manipulates the data itself, the data format, field names, record
structure and file structure. It also defines rules to validate and manipulate
this data.
MySQL
SQL server
Oracle
Microsoft access
Database administrator
The database administrator (DBA) is a person (or group of people) responsible
for overall control of the database system.
In this example you cannot insert text in Age and salary column. Only
numbers can be inserted. Each value in age and salary must be an integer.
End of slides
Do Review questions from page 13.