0% found this document useful (0 votes)
4 views

Database Systems Lecture 1

Uploaded by

Meregulwa Allan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Database Systems Lecture 1

Uploaded by

Meregulwa Allan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

DATABASE SYSTEMS

CPE2102

Year II, Semester I


21/08/2024 16:43 1
Course Description:
Database systems covers:
•E-R model
• Relational database systems
•SQL and how to Develop database systems using
SQL
•Concepts of Normalization and design of database
•Transaction management,
•Concurrency control and recovery
21/08/2024 16:43 2
MODE OF DELIVERY

Lectures
Practicals
Discussions

21/08/2024 16:43 3
MODE OF ASSESSMENT

Course work( Tests, Projects, Presentations) –


40%
Test I: Due 23/09/2024
Test II Due 21/10/2024

Written Examinations - 60%


21/08/2024 16:43 4
INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

• As the name suggests, the Database Management system


consists of two parts:

Database and
Management System

21/08/2024 16:43 5
DEFINITIONS
Data: Refers to raw facts that can be recorded and which
have implicit meaning.

Example:

• Customer ----
1.cname.
2.cno.
3.ccity.
21/08/2024 16:43 6
DEFINITIONS…
Data…

• Data can be organized into two types:

Flat File. Data is stored in a single table.


• Usually suitable for less amount of data.

Relational. Data is stored in multiple tables and the tables are


linked using a common field.
• Relational is suitable for medium to large amount of data.
21/08/2024 16:43 7
DEFINITIONS…
 Information: This refers to data that has been converted
into more useful or intelligent form.

 For example:
 Report card sheet
 The information is needed for the following reasons:
• To gain knowledge about the surroundings.
• To keep the system up to date.
• To know about the rules and regulations of the society.
21/08/2024 16:43 8
DEFINITIONS…
 Knowledge: Knowledge implies familiarity, awareness and
understanding of information as it applies to an environment.
• A key characteristic of knowledge is that ‘new’ knowledge can be
derived from ‘old’ knowledge.
• The human mind purposefully organizes the information and
evaluates it to produce knowledge.

Example of data, information and knowledge

• A student secures 450 marks. Here 450 is data, marks of the


student is the information and hard work required to get the
marks is knowledge.
21/08/2024 16:43 9
DATA, INFORMATION, KNOWLEDGE

21/08/2024 16:43 10
DEFINITIONS…

End-user data: raw facts of interest to end user.

Metadata: data about data.


• Provides description of data characteristics and
relationships in data.
• Complements and expands value of data.

21/08/2024 16:43 11
DATA MANAGEMENT
• This is a discipline that focuses on the proper generation, storage
and retrieval of data.

BENEFITS OF GOOD DATA MANAGEMENT


• Optimum data quality
• Improved user confidence
• Efficient and timely access to data
• Improved knowledge and understanding of the agency’s data
holdings
• Improved decision making
21/08/2024 16:43 12
DISADVANTAGES OF POOR DATA MANAGEMENT

• Misinterpretation of the data


• Loss of data
• Inaccessible data
• Indefensible data
• Missed deadlines
• Loss of user confidence

21/08/2024 16:43 13
PURPOSE OF DATABASE SYSTEMS

• Database systems arose in response to early methods of


computerized management of commercial data.

• As an example of such methods, typical of the 1960s,


consider part of a university organization that, among other
data, keeps information about all instructors, students,
departments, and course offerings.

21/08/2024 16:43 14
PURPOSE OF DATABASE SYSTEMS…
• One way to keep the information on a computer is to store it in
operating system files. To allow users to manipulate the information,
the system has a number of application programs that manipulate the
files, including programs to:
Add new students, instructors, and courses
Register students for courses and generate class rosters
Assign grades to students, compute grade point averages (GPA),
and generate transcripts

• System programmers wrote these application programs to meet the


needs of the university.
21/08/2024 16:43 15
PURPOSE OF DATABASE SYSTEMS…
• New application programs are added to the system as the
need arises. For example, suppose that a university decides to
create a new major (say, computer science).

• As a result, the university creates a new department and


creates new permanent files (or adds information to existing
files) to record information about all the instructors in the
department, students in that major, course offerings, degree
requirements, etc.
21/08/2024 16:43 16
PURPOSE OF DATABASE SYSTEMS…

• The university may have to write new application programs


to deal with rules specific to the new major.

• New application programs may also have to be written to


handle new rules in the university.

• Thus, as time goes by, the system acquires more files and
more application programs.

21/08/2024 16:43 17
PURPOSE OF DATABASE SYSTEMS…
• This typical file-processing system is supported by a
conventional operating system.

• The system stores permanent records in various files, and it


needs different application programs to extract records from,
and add records to, the appropriate files.

• Before database management systems (DBMSs) were


introduced, organizations usually stored information in such
systems.
21/08/2024 16:43 18
TRADITIONAL APPROACH TO DATA MANAGEMENT

File-based Data Management System

• Also known as file-processing system or de-centralized


approach

• File-based data management can be defined as the situation


where data is stored in one or more separate computer files
defined and managed by different application programs.

• Changes or updates are made to these files separately. E.g., the


details of customers may be stored in one file, orders in another,
etc.
21/08/2024 16:43 19
FILE-BASED DATA MANAGEMENT SYSTEM
Diagram showing how different applications will each have their own
copy of the files they need in order to carry out the activities for which
they are responsible:

21/08/2024 16:43 20
FILE-BASED DATA MANAGEMENT SYSTEM...

ADVANTAGES OF FILE-BASED SYSTEMS

• Easy to use
• Inexpensive
• Faster performance
• Suitable for personal data management

21/08/2024 16:43 21
FILE-BASED DATA MANAGEMENT SYSTEM...

DISADVANTAGES OF FILE-BASED SYSTEMS

Data redundancy. The same information may be duplicated in


several places (files). This redundancy leads to higher storage and
access cost.

Data inconsistency. Since different programmers create the files and


application programs over a long period, the various files are likely to
have different structures and the programs may be written in several
programming languages. In addition, the various copies of the same
data may no longer agree.
21/08/2024 16:43 22
DISADVANTAGES OF FILE-BASED SYSTEMS…

Difficulty in accessing data. Accessing data is not convenient and


efficient in file-based systems.

 Example
• Suppose that one of the company clerks needs to find out the
names of all employees who live within a particular postal-code
area.

• The clerk asks the data-processing department to generate such a


list. Because the designers of the original system did not anticipate
this request, there is no application program before hand to meet it.
21/08/2024 16:43 23
DISADVANTAGES OF FILE-BASED SYSTEMS…
Integrity problems. Data integrity means that the data contained in
the database is both correct and consistent. The data values stored in
the database must satisfy certain types of consistency constraints.
• Suppose the company maintains an account for each department, and
records the balance amount in each account. Suppose also that the
university requires that the account balance of a department may never
fall below zero.
• Developers enforce these constraints in the system by adding
appropriate code in the various application programs.
• However, when new constraints are added, it is difficult to change the
programs to enforce them.
• The problem is compounded when constraints involve several data
items from different files.
21/08/2024 16:43 24
DISADVANTAGES OF FILE-BASED SYSTEMS…
Atomicity problems. A computer system, like any other device, is
subject to failure. In many applications, it is crucial that, if a failure
occurs, the data be restored to the consistent state that existed prior to
the failure.
• Consider a program to transfer $500 from the account balance of
department A to the account balance of department B. If a system
failure occurs during the execution of the program, it is possible that
the $500 was removed from the balance of department A but was not
credited to the balance of department B, resulting in an inconsistent
database state. Clearly, it is essential to database consistency that
either both the credit and debit occur, or that neither occur. That is, the
funds transfer must be atomic—it must happen in its entirety or not at
all. It is difficult to ensure atomicity in a conventional file-processing
system.
21/08/2024 16:43 25
DISADVANTAGES OF FILE-BASED SYSTEMS…

Concurrent-access anomalies.
• For the sake of overall performance of the system and faster response,
many systems allow multiple users to update the data simultaneously.
Indeed, today, the largest Internet retailers may have millions of
accesses per day to their data by shoppers.
• In such an environment, interaction of concurrent updates is possible
and may result in inconsistent data. To guard against this possibility,
the system must maintain some form of supervision.
• But supervision is difficult to provide because data may be accessed
by many different application programs that have not been coordinated
previously.
21/08/2024 16:43 26
DISADVANTAGES OF FILE-BASED SYSTEMS…

Security problems. Not every user of the database system


should be able to access all the data.

• For example, in a university, a payroll personnel needs to see


only that part of the database that has financial information.
• They do not need access to information about academic
records.
• But, since application programs are added to the file-
processing system in an ad hoc manner, enforcing such
security constraints is difficult.
21/08/2024 16:43 27
DISADVANTAGES OF FILE-BASED SYSTEMS…

Separation and isolation.


• Data is scattered among different files, each file
belonging to a certain department, and files may be in
different formats.

• This makes writing of new application programs to


retrieve the appropriate data difficult.
21/08/2024 16:43 28
DISADVANTAGES OF FILE-BASED SYSTEMS…
Program-data dependence.
• Each file belongs to a certain application program. This could
easily lead to incompatible file formats between applications,
meaning that it becomes impossible to share data between
them.

• Another aspect is that data definition is embedded in the


application program. That means that if the physical structure
of data is to be changed – for instance, if instead of representing
a year with two digits, it is to be represented with four – then
the application program itself must be changed.
21/08/2024 16:43 29
DISADVANTAGES OF FILE-BASED SYSTEMS…

Lack of data sharing and availability


• Information cannot flow freely across different functional
areas or different parts of the organization.

• Users find different values of the same piece of information


in two different systems, and hence they may not use these
systems because they cannot trust the accuracy of the data

21/08/2024 16:43 30
DISADVANTAGES OF FILE-BASED SYSTEMS…

Complex systems administration.


• Systems administration becomes more difficult as the number
of files in the system expands. Even a simple file system with
a few files requires creating and maintaining several file
management programs.

• Each file must have its own file management program that
allow the user to add, modify and delete records; to list the
file contents and to generate reports.
21/08/2024 16:43 31
DEFINITIONS…
Record/ Tuple: Collection of related data items.

CName CNo Ccity


Sam 001 Cairo
Jalia 005 Kampala

• Rows are called records or tuples.


• In the above diagram, there are two records:

• Sam 001 Cairo


• Jalia 005 Kampala
21/08/2024 16:43 32
DEFINITIONS…
Table or Relation: Collection of related records

CName CNo Ccity


Sam 001 Cairo
Jalia 005 Kampala
Dora 009 Cairo

The columns of this relation are called Fields, Attributes or


Domains.
21/08/2024 16:43 33
DEFINITIONS…

Database: It is a Collection of related relations.


•A database can be of any size and varying complexity.

•A database may be generated and manipulated


manually or it may be computerized.

21/08/2024 16:43 34
Database…
Consider the following collection of tables:

21/08/2024 16:43 35
Database…
• We have a collection of 4 tables. They can be called a
“related collection” because we can clearly find out that there
are some common attributes existing in a selected pair of
tables.
• Because of these common attributes we may combine the
data of two or more tables together to find out the complete
details of a student.
• Questions like “Which hostel does the youngest student live
in?” can be answered now, although Age and Hostel attributes
are in different tables.
21/08/2024 16:43 36
Database…
• A database in a DBMS could be viewed by lots of different
people with different responsibilities.

21/08/2024 16:43 37
Database…
Example
• Within a company there are different departments, as well as customers,
who each needs to see different kinds of data.

• Each employee in the company will have different levels of access to the
database with their own customized front-end application.

• In a database, data is organized strictly in row and column format. The


data items within one row may belong to different data types.

• NB: All the data items within a single attribute/column are of the same
data type.
21/08/2024 16:43 38
DEFINITIONS…

DATABASE SERVERS

• Database servers are dedicated computers that hold the


actual databases and run only the DBMS and related
software.

21/08/2024 16:43 39
TYPES OF DATABASES

Centralized databases.
• A centralized database is one that operates entirely within a
single location such as a central computer.

•Users can then access the database through a computer


network, but it is the central computer that runs and maintains
the database.

•Centralized databases are typically used by bigger


organizations, such as a business or university.
21/08/2024 16:43 40
TYPES OF DATABASES…

Cloud Databases.
• Here data is stored on a local hard drive or server, but the
information is available online.
• This makes it easy to access your files from anywhere, as
long as you have an Internet connection.
• To use a cloud database, users can either build one
themselves or pay for a service to store their data for them.
• Encryption is an essential part of any cloud database, as all
information needs to be protected as it is transmitted online.
21/08/2024 16:43 41
TYPES OF DATABASES…

Commercial Databases.
• A commercial database is a feature-rich database that is
designed by a commercial businesses to sell to their
customers.

• The defining trait of commercial databases is having users


pay to use them, unlike open-source databases.

21/08/2024 16:43 42
TYPES OF DATABASES…
Distributed Databases.
• A distributed database is basically a database that is not
limited to one system, it is spread over different sites, i.e.,
on multiple computers or over a network of computers.
• A distributed database system is located on various sites
that don’t share physical components.
• This may be required when a particular database needs to
be accessed by various users globally.
• It needs to be managed such that for the users it looks like
one single database.

21/08/2024 16:43 43
TYPES OF DATABASES…
End-user Databases.
• End-user is a term used in product development that
refers to the person who uses the product.

• An end-user database is, therefore, a database that is


primarily used by a single person.

• A good example of this type of database is a


spreadsheet stored on your local computer.
21/08/2024 16:43 44
MANAGEMENT SYSTEM
• The management system is important because without the existence of
some kind of rules and regulations it is not possible to maintain the
database.

• We have to select the particular attributes which should be included in


a particular table; the common attributes to create relationship between
two tables; if a new record has to be inserted or deleted then which
tables should have to be handled etc.

• These issues must be resolved by having some kind of rules to follow


in order to maintain the integrity of the database.
21/08/2024 16:43 45
APPLICATION AREAS OF DATABASES
• Databases touch all aspects of our lives. Some of the major areas of
application are as follows:

Banking and Finance


 Banking: For customer information, accounts, loans, and banking
transactions.
 Credit card transactions: For purchases on credit cards and
generation of monthly statements.
 Finance: For storing information about holdings, sales, and
purchases of financial instruments such as stocks and bonds; also,
for storing real-time market data to enable online trading by
customers and automated trading by the firm
21/08/2024 16:43 46
APPLICATION AREAS OF DATABASES

Universities: For student information, course registrations, and


grades (in addition to standard enterprise information such as human
resources and accounting).

Airlines: For reservations and schedule information. Airlines were


among the first to use databases in a geographically distributed
manner.

Telecommunication: For keeping records of calls made, generating


monthly bills, maintaining balances on prepaid calling cards, and
storing information about the communication networks.
21/08/2024 16:43 47
APPLICATION AREAS OF DATABASES…

Sales: For customer, product, and purchase information.


Accounting: For payments, receipts, account balances, assets
and other accounting information.
Human resources: For information about employees, salaries,
payroll taxes, and benefits, and for generation of pay checks.
Manufacturing: For management of the supply chain and for
tracking production of items in factories, inventories of items in
warehouses and stores, and orders for items.
Online retailers: For online order tracking, generation of
recommendation lists, and maintenance of online product
evaluations.
21/08/2024 16:43 48

You might also like