Uploaded by abdulhanan7710

ICT 09 Chapter 11A Database Management

advertisement
“Database Management”
in
[ Introduction to Computers ]
Lecture‐09
M. M. Yasin
myasin@cuisahiwal.edu.pk
[ Course Outline ]
1. Introduction and History
2. Parts & Details of Computer System:
I. Input/Output
II. Central Processing Unit
III. Storage/Memory
3.
4.
5.
6.
Networking and Data Communications
Database Management
Software Programming
Protective/Security Measures
Fall 2022 ‐ M. M. Yasin
1.2
[ Topics Covered ]
1. Database and Database Management Systems (DBMS)
I.
II.
The Database
The Database Management System
2. Working with a Database
I.
II.
III.
IV.
V.
Creating Database Tables
Viewing Records
Sorting Records
Querying a Database
Generating Reports
1. Relational Database Management System (RDBMS)
I.
II.
III.
Relationships
Normalization
RDBMS Products
Note: Topics covered are from chapter 11A of Introduction to Computers.
Fall 2022 ‐ M. M. Yasin
1.3
Database and Database Management Systems
(DBMS)
Database:
It is a collection of related data or facts, arranged in a specific
structure.
The purpose is to make this data useful.
Database Management System (DBMS):
It is a software tool that allows one to store, access, and
process data or facts into useful information.
For example, a DBMS contains thousands or millions of
addresses of people living in a country. Using DBMS one can,
• Find people with the same zip code or province or city.
• Find number of males/females or children/adults in a specific
area.
Fall 2022 ‐ M. M. Yasin
1.4
Database and Database Management Systems
(DBMS)
Database:
Three of the most important terms to know about databases are:
1. Fields:
Each piece of data is stored in its own location, called a field. For
example, each entry has a field for Name, Gender, Address,
Province, City, ZIP code, etc. The term column is sometimes used
instead of field.
2. Records:
One full set of fields. i.e., all the related data about one person or
object is called a record. The term row is sometimes used instead
of record.
3. Tables:
A complete collection of records makes a table.
Fall 2022 ‐ M. M. Yasin
1.5
Database and Database Management Systems
(DBMS)
Database:
Once we have a structure for storing data, one can add new
data, create reports and perform other tasks with the data.
For example, one can create report that groups people by ZIP
code. These extra documents (forms, reports) along with the
tables, collectively form a database as shown in the figure (next
slide).
Forms: These are documents that are filled in to create records.
Reports: These are documents that display a selected portion of a
database’s information.
Fall 2022 ‐ M. M. Yasin
1.6
Database and Database Management Systems
(DBMS)
Database:
Fall 2022 ‐ M. M. Yasin
1.7
Database and Database Management Systems
(DBMS)
Database Management System (DBMS):
It is a program(s) that allows to access and modify the data. It
also provides tools to construct special requests (called queries)
to find specific records in the database. Data management tasks
fall into one of four general categories:
1. Entering data into the database.
2. Housekeeping tasks, such as updating data, deleting obsolete
records, and backing up the database.
3. Sorting the data. i.e., arranging the database’s records.
4. Obtaining subsets of the data.
Fall 2022 ‐ M. M. Yasin
1.8
Working with a Database
With the help of DBMS tools, one can perform the following
data management functions:
1. Creating tables
2. Viewing records
3. Sorting records
4. Creating queries
5. Generating reports
Fall 2022 ‐ M. M. Yasin
1.9
Working with a Database
1. Creating Database Tables:
This is the first step in building any database. In this, one must
define each field in the table by following a three‐step process:
• Name the field
• Specify the field type
• Specify the field size
2. Viewing Records:
The way data appears on the screen. This makes it easier for the
user to work with the data.
Fall 2022 ‐ M. M. Yasin
1.10
Working with a Database
3. Sorting Records:
This is one of the most powerful features of DBMS. For
example, one can sort the data into numerical order by ID or
into alphabetical order by name.
Sometimes viewing the entire table is not possible because of
too many entries. Filters are a DBMS feature for displaying a
selected list or subset of records from a table.
The visible records satisfy a condition that the user sets and
hiding those that do not.
Fall 2022 ‐ M. M. Yasin
1.11
Working with a Database
4. Querying a Database:
This is similar to sorting. One can enter criteria that:
•Allows the DBMS to locate records.
•Lists a subset of records.
•Establishes relationships or links
between tables to update records.
•Performs calculations.
•Performs other data management tasks. •Deletes obsolete records.
This type of request is called a query. i.e., a user‐constructed
statement that describes data and sets criteria so that the DBMS
can gather the desired data and provide specific information.
In other words, query is a more powerful type of filter that can
gather information from multiple tables.
Fall 2022 ‐ M. M. Yasin
1.12
Working with a Database
4. Querying a Database:
Some database systems provide special windows or forms for
creating queries.
It should be possible to generate a single language that can, in
theory, query any database. With this, a user can query any
database, regardless of who created the database.
SQL (Structured Query Language) and Xbase are powerful query
languages.
Fall 2022 ‐ M. M. Yasin
1.13
Working with a Database
5. Generating Reports:
A report is printed information that, like a query‐result, is
assembled by gathering data based on user‐supplied criteria.
Reports can range from
simple lists of records to
customized formats for
specific purposes.
Fall 2022 ‐ M. M. Yasin
1.14
Relational Database Management System
(RDBMS)
It is an organized collection of data items present as a set of
formally described tables.
The data in these tables can be viewed, modified and also
reassembled in different ways as per the user’s requirement,
without reorganizing the database tables.
Each table contains columns of one or more categories of data.
The rows have a unique instance (illustration) of data for the
categories defined in each column.
Fall 2022 ‐ M. M. Yasin
1.15
Relational Database Management System
(RDBMS)
Consider a database having student’s information.
It would have a table having columns for a student’s name,
registration number, dept, section etc.
The same database can also have another table with the details
of marks secured by the students having columns with headings
name, registration number, subject‐1, subject‐2, pass, fail, rank
etc.
Different users can view this database as per their requirement.
Fall 2022 ‐ M. M. Yasin
1.16
Relational Database Management System
(RDBMS)
Difference Between RDBMS and DBMS
RDBMS is an advanced version of a DBMS system. It allows to
access data more efficiently than DBMS.
RDBMS
DBMS
Data stored is in table format.
Data stored is in the file format.
Data is linked together.
No connection between data.
Data is stored in a large amount.
Data stored is a small quantity.
Low data redundancy due to of keys.
High data redundancy.
High SW/HW requirements.
Low SW/HW requirements.
Products: Oracle, SQL Server.
Products: XML, Microsoft Access.
Fall 2022 ‐ M. M. Yasin
1.17
Relational Database Management System
(RDBMS)
Every table in the database is assumed to be a single entity.
Every entity is used to represent an object or person or an event
for which various data are stored. In a library database, few of
the entities are student ID, book title, author etc.
All entities in a table are related to one another by relationships.
Various tables are connected using these relationships formed
by the keys.
There are two types of keys: primary key and foreign key.
A field used to identify a specific record (present in a table)
uniquely is called a primary key.
Foreign keys are used for the establishment of a relationship in
between the main table and the subsidiary (secondary) tables.
Fall 2022 ‐ M. M. Yasin
1.18
Relational Database Management System
(RDBMS)
Relational Database Management System (RDBMS):
Relationships:
It is a link between two tables of database. When a relationship
is created, a record in one table is connected to one or many
records in another table.
Normalization:
It is a set of rules which are designed for ensuring the
organization of a database in the best possible way.
These rules are based on the relationships between the entities.
It enables efficient processing of data and queries.
Fall 2022 ‐ M. M. Yasin
1.19
Relational Database Management System
(RDBMS)
Relational Database Management System (RDBMS):
Relationships:
There are three types of relationships:
1. One‐To‐One Relationships
2. One‐To‐Many Relationships
3. Many‐To‐Many Relationships
Fall 2022 ‐ M. M. Yasin
1.20
Relational Database Management System
(RDBMS)
Relational Database Management System (RDBMS):
Relationships:
1. One‐To‐One Relationships:
A row in table A can have only one matching row in table B,
and vice versa. For example, in a school, a student can belong
to only one group.
Fall 2022 ‐ M. M. Yasin
1.21
Relational Database Management System
(RDBMS)
Relational Database Management System (RDBMS):
Relationships:
2. One‐To‐Many Relationships:
A row in table A has many matching rows in table B. For
example, a student can learn many subjects.
Fall 2022 ‐ M. M. Yasin
1.22
Relational Database Management System
(RDBMS)
Relational Database Management System (RDBMS):
Relationships:
3. Many‐To‐Many Relationships:
Rows in table A can match
with more than one row
in table B and vice versa.
For example, a school can
have many teachers and
each teacher can teach
many subjects.
Fall 2022 ‐ M. M. Yasin
1.23
Relational Database Management System
(RDBMS)
RDBMS Products:
The most familiar products of RDBMS are:
• SQL Server by Microsoft
• Oracle by Oracle Corporation
• DB2 by IBM
Fall 2022 ‐ M. M. Yasin
1.24
Download