SlideShare a Scribd company logo
1 of 43
1
Introduction To Computer
Lecture # 18-19
Lecturer in Department of Computer Science & Software Engineering,
International Islamic University, Islamabad
Outlin
es
Chapter 7:
Databases
Introduction
Traditional File Processing System
 Limitations of Traditional File
Processing Systems
Database Management System
 Advantages of DBMS
Database Design Concepts
Database Design
 Conceptual Database Design
 Logical Database Design
 Physical Database Design
Types of Database
MS Access
Database Design in MS Access
Introduction
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 3
• A collection of logically related data organized to be accessed, managed and
updated easily.
• Small data collection or a large scale database.
• Used for various purposes including:
 Storing internal data
 Analyzing the market
 Analyzing users’ interest
 Discovering patterns in data and more.
• Information is organized in rows and columns
(forming tables).
• Indexed information:
 Easier search.
 Easier modification.
 Easy to add or remove data items.
Introduction
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 4
 Data
• Facts concerning objects and events.
• A salesperson’s data:
 Names
 Addresses
 Phone numbers
 Items
 Prices and more.
• Numeric data
• Textual data
• Graphic data (Pictures and videos)
• Qualitative data
• Quantitative data.
Introduction
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 5
 Information
• Structured / processed data.
• Meaningful in some context.
• Well organized data on the basis of which an organization can take some
decision and can discover useful patterns in it.
Data Information
Introduction
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 6
 Metadata
• Data about data.
• Describes the characteristics and context of data.
• The primary mechanism to provide the context for data.
• Examples:
 Data type
 Length
 Maximum/minimum values
Traditional File Processing System
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 7
• Spreadsheets, word processing applications.
• A group of files that store data of an organization.
• Manual/computer based filling systems.
• All the departments have to maintain their own sets of files.
 Limitations
• Duplicate data; complex and hard to manage.
• Separate sets of files for each department or organization.
• Limited data sharing.
• Hard to develop and maintain.
• Excessive program maintenance.
• Less security.
Database Management System
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 8
• A computer software for creating and maintaining databases.
• A systematic way to create, retrieve, update and manage data.
• An interface between the database and the user.
• DBMS manages three things:
 The data.
 Database Engine, used to access and modify the data.
 Database Schema i.e. the logical structure of the database.
 Advantages
• Data Sharing
 A centralized database, visible to every user and department.
• Concurrency
 Multiple users can work with the database to add, update and update data.
Database Management System
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 9
 Advantages (continued…)
• Data Integrity
 Consistent, accurate and trustworthy data.
• Data Quality
 Improved data quality by specifying integrity constraints i.e. rules that can’t be
violated by database administrators.
• No Redundancy
 Data is recorded in a centralized database accessible from everywhere.
• Backup and Recovery
 Backup and recovery mechanism recovers the database in case of accidental loss.
• Security and Privacy
 Limited access to end users.
 Data can be accessed and modified only by authorized person.
 Limited privileges for each user
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 10
 Entity
• A person, place, object or event.
• Must be of some interest to the organization.
• E.g. a college database may contain Student,
Teacher, Admission and Courses etc.
• Represented by a Rectangle.
Entities
Product
Customer
Order
Sales
man
Exam
Building
Room
Course
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 11
 Attributes
• A property of an entity that is of interest to the organization.
• E.g. the Student entity may have an id, name, address, admission number etc.
• Represented by circles, or alternatively in form of a table.
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 12
 Relationships
• An association that represents interaction among in a database.
• For example, a student in a college may have many courses and a course can be
completed by several students.
• A relationship may be:
 One to one
 Many to one
 Many to many
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 13
 Entity Relationship Diagram
• A detailed logical representation of the data in an organization.
 Entities
 Relationships among entities
 Attributes of the entities and relationships.
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 14
 Relation
• A named, two dimensional table of data with:
 A set of named columns (representing attributes)
 Arbitrary number of unnamed rows (representing data values for a single entity)
• In its simplest form, a relation is denoted as:
 Student (ID, Name, Address, Phone_no, Major)
• Or
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 15
 Table
• A collection of data held in a structured format within
a database.
• Vertical columns, identified by names.
• Horizontal rows, holding data for a single entity.
• Similar to relation with some differences:
 Metadata associated, e.g. constraints
 May have duplicate values unlike relation.
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 16
 Record
• A complete set of information, relevant to a specific entity.
• Also called row; comprised of a single row in a table.
• Example:
 The information (values against each attribute) for a specific student.
Database Design Concepts
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 17
 File
• A related collection of records.
• Example:
 A collection of the records of all the students enrolled in a course.
 Field
• A data structure for a single piece of data.
• Example:
 Customer_ID, Name, Address, Phone_no are some of the fields in the table
Customer in an organization’s database.
• Fields are organized into records.
Database Design
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 18
 Conceptual Database Design
• First step of database design.
• Entities and their relationships are recognized by studying the organization.
• Output:
 Entity relationship model, comprised of entities and their relationships
Database Design
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 19
 Logical Database Design
• An extended version of the conceptual design:
 Entities, their attributes and the relationships.
 Primary keys (that uniquely define entities of an entity type).
 Foreign keys (used to relate two tables).
 Redundancy and other anomalies removed by Normalization.
Database Design
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 20
 Physical Database Design
• The logical database design is converted into a detailed design.
• Data types and lengths etc. of the attributes.
• The output is a design ready to be implemented.
Types of Database
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 21
 Flat File Database
• Files with no structured relationships among the records.
• Data is stored in a single table.
• Useful for storing small amount of records.
• Example: Spreadsheets.
 Document Oriented Database
• Data is stored in form of text records rather than tables.
• Useful for document based application.
 Embedded Database
• Runs within an application rather than a separate database application.
• Integrated with program that needs to store data.
• Hidden from the user, requiring little or no maintenance.
Types of Database
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 22
 Distributed Database
• A set of interconnected databases located at different locations.
• Logically a single database.
• Data is accessed and modified with the help of a network.
Types of Database
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 23
 Centralized Database
• Located and maintained on a single location.
• Accessible from different locations via a network.
 Knowledge Base
• Stores complex information used by computer systems.
• Structured or unstructured data.
• Examples:
 Expert system, which uses knowledge base containing facts about a specific field.
 Hypertext Database
• Used to organize large, dissimilar information.
• No regular structure, different from commonly used databases.
• Example:
 Databases for maintaining encyclopedias.
Types of Database
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 24
 Operational Databases
• Store data related to the operations in an organization.
• Used to modify (add, update or delete) data in real time.
• Example:
 A database storing daily transactions data of an organization.
 Online Database
• Database made accessible form the internet.
• Hosted on websites, to be accessed using a web browser.
• May be free or may require subscription.
MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 25
• A DBMS, part of the MS Office suite.
• Lightweight and easy to use tool for designing database.
• Not suitable for designing large scale databases.
• Used to design and maintain small scale databases.
• Key features:
 Creating databases
 Creating tables
 Creating relations
 Inserting data into tables
 Data validation
 Creating forms
 Creating Queries
 Creating reports and more.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 26
 Creating Database
• File  New  Blank desktop database.
• Choose a destination folder and click “Create”.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 27
 Creating Tables
• Navigate to Create tab on the ribbon and click
Table.
• A table “Table 1” will be created. Right click on it
and click “Save”.
• Name the table, e.g. Student.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 28
 Creating Tables (continued…)
• Each table is created with one field, the ID.
• Right click it and rename to something relevant to the table, e.g. Student_ID.
• ID field should be “Auto Number” and “Unique” as it is the primary key.
• This is done by selecting the field and navigating to the FIELDS tab on the
ribbon.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 29
 Creating Tables (continued…)
• To add a new field, click on “Click to Add” and select a suitable datatype, e.g.
“Short Text” for the field Name.
• Create all the fields in the table the same way
and save the table.
• Right click on the table and select “Design View”
to view the table in design view.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 30
 Inserting Data into Tables
• Switch to datasheet view and insert records.
• The ID will be generated automatically for each record being inserted.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 31
 Data Validation
• To restrict the user not to enter invalid data.
• E.g. currency and price can’t be negative, a field can accept only letters etc.
• Achieved by the use of validation rules.
• Add validation rules to a table:
 Right click on the table and select
“Design View”.
 Highlight the field to which a
validation rule is to be added.
 Add the validation rule against
“Validation Rule” in the field
properties.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 32
 Validation Rules
• Example, validation rule for email field:
Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[ ,;]*"))
Where “Is Null” means the field can be empty.
• Commonly used validation rules:
To do….. Validation Rule
Accept letters only Is Null OR Not Like "*[!a-z]*"
Accept digits only Is Null OR Not Like "*[!0-9]*"
Accept digits and letters only Is Null OR Not Like "*[!((a-z) or (0-9))]*"
Accept a string of exactly 5 characters Is Null OR Like "?????"
Accept a value of exactly 4 digits Is Null OR Like "####"
Accept positive numbers only Is Null OR >=0
Accept date that is not future date Is Null OR <= Date()
Accept only “Male” and “Female” Is Null OR "Male" OR "Female"
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 33
 Creating Query
• To manipulate data in the database, e.g. to update a field or delete a record.
• Example: Update student name in the first record.
 Create  Query Design
 Select the table (Students) and click Add.
 Next, click Update in Design tab
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 34
 Creating Query (continued…)
 Double click the field (Name) to be updated.
 Enter the new value in the Update To box.
 Also enter the old value in the Criteria box.
 Finally click Run in the Design tab to run the
query.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 35
 Creating Forms
• An object used to create user interface for the database.
• Used to access and view data from one or more tables in a database.
• Procedure:
 Create  Form Wizard
 Select a table from the
dropdown list and double click
the fields which are to be added
to the form.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 36
 Creating Forms (continued…)
 On the next screen, select a layout for the form.
 Give the query a name before finishing.
 In Form View, the output would be something like this.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 37
 Creating Reports
• An object used to display data from the database.
• Pick data from one or more tables using a query and then create a report.
• Example:
 A report containing names, addresses and phone number of students.
 Create a query that selects
names, addresses and
phone number of all the
students in the table.
 Select the query and click
on Create  Report
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 38
 Creating Reports (continued…)
 The report opens in Layout mode where its layout can be changed.
 Switch to report view and you will see an output like this.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 39
 Importing Tables to Database
• Import wizard is used to import tables etc.
from a .mdb or .accdb database.
• EXTERNAL DATA  Access
• Locate the existing database file in the wizard.
• Select “Import tables, queries, forms, reports, macros and modules”.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 40
 Importing Tables to Database (continued…)
• Select the tables, queries and forms etc. that are to be imported into the
database.
• Click OK to finish import. The selected items should appear in your database.
Database Design in MS Access
Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 41
 Linking Tables with Database
• To have one or more tables in multiple databases.
• The tables are stored in a single database and are linked to as many
databases as needed.
• Eliminates the need to enter or update the same data multiple times.
• Procedure:
 Similar to importing tables to database.
 Repeat the process, selecting “Link to data
sources by creating a linked table”.
 The linked tables appear in the database with
a star.
References
 Ali, R. & Ali, A. (2018). Chapter 7: Databases. Introduction to Computer
and ICT – 1st Edition (pp. 117-139). Muhalla Jangi, Qissa Khawani,
Peshawar, Pakistan: Al-ilum Publications.
Thanks!
Any Questions
?

More Related Content

Similar to Chapter 7. Databases Chapter In Introduction to Computer. Pptx

MIS-3rd Unit.pptx
MIS-3rd Unit.pptxMIS-3rd Unit.pptx
MIS-3rd Unit.pptxSumit Kumar
 
PPT-UEU-Basis-Data-Pertemuan-1.pptx
PPT-UEU-Basis-Data-Pertemuan-1.pptxPPT-UEU-Basis-Data-Pertemuan-1.pptx
PPT-UEU-Basis-Data-Pertemuan-1.pptxUbaidURRahman78
 
Management information system database management
Management information system database managementManagement information system database management
Management information system database managementOnline
 
dbms Unit 1.pdf arey bhai teri maa chodunga
dbms Unit 1.pdf arey bhai teri maa chodungadbms Unit 1.pdf arey bhai teri maa chodunga
dbms Unit 1.pdf arey bhai teri maa chodungaVaradKadtan1
 
Computer applications.pptx
Computer applications.pptxComputer applications.pptx
Computer applications.pptxEmmanuel235416
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfTamiratDejene1
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfTamiratDejene1
 

Similar to Chapter 7. Databases Chapter In Introduction to Computer. Pptx (20)

dbms introduction.pptx
dbms introduction.pptxdbms introduction.pptx
dbms introduction.pptx
 
Uc13.chapter.14
Uc13.chapter.14Uc13.chapter.14
Uc13.chapter.14
 
DBMS.ppt
DBMS.pptDBMS.ppt
DBMS.ppt
 
(Dbms) class 1 & 2 (Presentation)
(Dbms) class 1 & 2 (Presentation)(Dbms) class 1 & 2 (Presentation)
(Dbms) class 1 & 2 (Presentation)
 
BAB 7 Pangkalan data new
BAB 7   Pangkalan data newBAB 7   Pangkalan data new
BAB 7 Pangkalan data new
 
DBMS Lecture 1.ppt
DBMS Lecture 1.pptDBMS Lecture 1.ppt
DBMS Lecture 1.ppt
 
MIS-3rd Unit.pptx
MIS-3rd Unit.pptxMIS-3rd Unit.pptx
MIS-3rd Unit.pptx
 
MIS-3rd Unit.pptx
MIS-3rd Unit.pptxMIS-3rd Unit.pptx
MIS-3rd Unit.pptx
 
Database Lecture Notes
Database Lecture NotesDatabase Lecture Notes
Database Lecture Notes
 
Unit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptxUnit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptx
 
Database & Database Users
Database & Database UsersDatabase & Database Users
Database & Database Users
 
lecture 1.pdf
lecture 1.pdflecture 1.pdf
lecture 1.pdf
 
BDA-Module-1.pptx
BDA-Module-1.pptxBDA-Module-1.pptx
BDA-Module-1.pptx
 
PPT-UEU-Basis-Data-Pertemuan-1.pptx
PPT-UEU-Basis-Data-Pertemuan-1.pptxPPT-UEU-Basis-Data-Pertemuan-1.pptx
PPT-UEU-Basis-Data-Pertemuan-1.pptx
 
RowanDay4.pptx
RowanDay4.pptxRowanDay4.pptx
RowanDay4.pptx
 
Management information system database management
Management information system database managementManagement information system database management
Management information system database management
 
dbms Unit 1.pdf arey bhai teri maa chodunga
dbms Unit 1.pdf arey bhai teri maa chodungadbms Unit 1.pdf arey bhai teri maa chodunga
dbms Unit 1.pdf arey bhai teri maa chodunga
 
Computer applications.pptx
Computer applications.pptxComputer applications.pptx
Computer applications.pptx
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdf
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdf
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

Chapter 7. Databases Chapter In Introduction to Computer. Pptx

  • 1. 1 Introduction To Computer Lecture # 18-19 Lecturer in Department of Computer Science & Software Engineering, International Islamic University, Islamabad
  • 2. Outlin es Chapter 7: Databases Introduction Traditional File Processing System  Limitations of Traditional File Processing Systems Database Management System  Advantages of DBMS Database Design Concepts Database Design  Conceptual Database Design  Logical Database Design  Physical Database Design Types of Database MS Access Database Design in MS Access
  • 3. Introduction Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 3 • A collection of logically related data organized to be accessed, managed and updated easily. • Small data collection or a large scale database. • Used for various purposes including:  Storing internal data  Analyzing the market  Analyzing users’ interest  Discovering patterns in data and more. • Information is organized in rows and columns (forming tables). • Indexed information:  Easier search.  Easier modification.  Easy to add or remove data items.
  • 4. Introduction Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 4  Data • Facts concerning objects and events. • A salesperson’s data:  Names  Addresses  Phone numbers  Items  Prices and more. • Numeric data • Textual data • Graphic data (Pictures and videos) • Qualitative data • Quantitative data.
  • 5. Introduction Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 5  Information • Structured / processed data. • Meaningful in some context. • Well organized data on the basis of which an organization can take some decision and can discover useful patterns in it. Data Information
  • 6. Introduction Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 6  Metadata • Data about data. • Describes the characteristics and context of data. • The primary mechanism to provide the context for data. • Examples:  Data type  Length  Maximum/minimum values
  • 7. Traditional File Processing System Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 7 • Spreadsheets, word processing applications. • A group of files that store data of an organization. • Manual/computer based filling systems. • All the departments have to maintain their own sets of files.  Limitations • Duplicate data; complex and hard to manage. • Separate sets of files for each department or organization. • Limited data sharing. • Hard to develop and maintain. • Excessive program maintenance. • Less security.
  • 8. Database Management System Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 8 • A computer software for creating and maintaining databases. • A systematic way to create, retrieve, update and manage data. • An interface between the database and the user. • DBMS manages three things:  The data.  Database Engine, used to access and modify the data.  Database Schema i.e. the logical structure of the database.  Advantages • Data Sharing  A centralized database, visible to every user and department. • Concurrency  Multiple users can work with the database to add, update and update data.
  • 9. Database Management System Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 9  Advantages (continued…) • Data Integrity  Consistent, accurate and trustworthy data. • Data Quality  Improved data quality by specifying integrity constraints i.e. rules that can’t be violated by database administrators. • No Redundancy  Data is recorded in a centralized database accessible from everywhere. • Backup and Recovery  Backup and recovery mechanism recovers the database in case of accidental loss. • Security and Privacy  Limited access to end users.  Data can be accessed and modified only by authorized person.  Limited privileges for each user
  • 10. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 10  Entity • A person, place, object or event. • Must be of some interest to the organization. • E.g. a college database may contain Student, Teacher, Admission and Courses etc. • Represented by a Rectangle. Entities Product Customer Order Sales man Exam Building Room Course
  • 11. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 11  Attributes • A property of an entity that is of interest to the organization. • E.g. the Student entity may have an id, name, address, admission number etc. • Represented by circles, or alternatively in form of a table.
  • 12. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 12  Relationships • An association that represents interaction among in a database. • For example, a student in a college may have many courses and a course can be completed by several students. • A relationship may be:  One to one  Many to one  Many to many
  • 13. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 13  Entity Relationship Diagram • A detailed logical representation of the data in an organization.  Entities  Relationships among entities  Attributes of the entities and relationships.
  • 14. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 14  Relation • A named, two dimensional table of data with:  A set of named columns (representing attributes)  Arbitrary number of unnamed rows (representing data values for a single entity) • In its simplest form, a relation is denoted as:  Student (ID, Name, Address, Phone_no, Major) • Or
  • 15. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 15  Table • A collection of data held in a structured format within a database. • Vertical columns, identified by names. • Horizontal rows, holding data for a single entity. • Similar to relation with some differences:  Metadata associated, e.g. constraints  May have duplicate values unlike relation.
  • 16. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 16  Record • A complete set of information, relevant to a specific entity. • Also called row; comprised of a single row in a table. • Example:  The information (values against each attribute) for a specific student.
  • 17. Database Design Concepts Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 17  File • A related collection of records. • Example:  A collection of the records of all the students enrolled in a course.  Field • A data structure for a single piece of data. • Example:  Customer_ID, Name, Address, Phone_no are some of the fields in the table Customer in an organization’s database. • Fields are organized into records.
  • 18. Database Design Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 18  Conceptual Database Design • First step of database design. • Entities and their relationships are recognized by studying the organization. • Output:  Entity relationship model, comprised of entities and their relationships
  • 19. Database Design Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 19  Logical Database Design • An extended version of the conceptual design:  Entities, their attributes and the relationships.  Primary keys (that uniquely define entities of an entity type).  Foreign keys (used to relate two tables).  Redundancy and other anomalies removed by Normalization.
  • 20. Database Design Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 20  Physical Database Design • The logical database design is converted into a detailed design. • Data types and lengths etc. of the attributes. • The output is a design ready to be implemented.
  • 21. Types of Database Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 21  Flat File Database • Files with no structured relationships among the records. • Data is stored in a single table. • Useful for storing small amount of records. • Example: Spreadsheets.  Document Oriented Database • Data is stored in form of text records rather than tables. • Useful for document based application.  Embedded Database • Runs within an application rather than a separate database application. • Integrated with program that needs to store data. • Hidden from the user, requiring little or no maintenance.
  • 22. Types of Database Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 22  Distributed Database • A set of interconnected databases located at different locations. • Logically a single database. • Data is accessed and modified with the help of a network.
  • 23. Types of Database Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 23  Centralized Database • Located and maintained on a single location. • Accessible from different locations via a network.  Knowledge Base • Stores complex information used by computer systems. • Structured or unstructured data. • Examples:  Expert system, which uses knowledge base containing facts about a specific field.  Hypertext Database • Used to organize large, dissimilar information. • No regular structure, different from commonly used databases. • Example:  Databases for maintaining encyclopedias.
  • 24. Types of Database Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 24  Operational Databases • Store data related to the operations in an organization. • Used to modify (add, update or delete) data in real time. • Example:  A database storing daily transactions data of an organization.  Online Database • Database made accessible form the internet. • Hosted on websites, to be accessed using a web browser. • May be free or may require subscription.
  • 25. MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 25 • A DBMS, part of the MS Office suite. • Lightweight and easy to use tool for designing database. • Not suitable for designing large scale databases. • Used to design and maintain small scale databases. • Key features:  Creating databases  Creating tables  Creating relations  Inserting data into tables  Data validation  Creating forms  Creating Queries  Creating reports and more.
  • 26. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 26  Creating Database • File  New  Blank desktop database. • Choose a destination folder and click “Create”.
  • 27. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 27  Creating Tables • Navigate to Create tab on the ribbon and click Table. • A table “Table 1” will be created. Right click on it and click “Save”. • Name the table, e.g. Student.
  • 28. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 28  Creating Tables (continued…) • Each table is created with one field, the ID. • Right click it and rename to something relevant to the table, e.g. Student_ID. • ID field should be “Auto Number” and “Unique” as it is the primary key. • This is done by selecting the field and navigating to the FIELDS tab on the ribbon.
  • 29. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 29  Creating Tables (continued…) • To add a new field, click on “Click to Add” and select a suitable datatype, e.g. “Short Text” for the field Name. • Create all the fields in the table the same way and save the table. • Right click on the table and select “Design View” to view the table in design view.
  • 30. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 30  Inserting Data into Tables • Switch to datasheet view and insert records. • The ID will be generated automatically for each record being inserted.
  • 31. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 31  Data Validation • To restrict the user not to enter invalid data. • E.g. currency and price can’t be negative, a field can accept only letters etc. • Achieved by the use of validation rules. • Add validation rules to a table:  Right click on the table and select “Design View”.  Highlight the field to which a validation rule is to be added.  Add the validation rule against “Validation Rule” in the field properties.
  • 32. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 32  Validation Rules • Example, validation rule for email field: Is Null OR ((Like "*?@?*.?*") AND (Not Like "*[ ,;]*")) Where “Is Null” means the field can be empty. • Commonly used validation rules: To do….. Validation Rule Accept letters only Is Null OR Not Like "*[!a-z]*" Accept digits only Is Null OR Not Like "*[!0-9]*" Accept digits and letters only Is Null OR Not Like "*[!((a-z) or (0-9))]*" Accept a string of exactly 5 characters Is Null OR Like "?????" Accept a value of exactly 4 digits Is Null OR Like "####" Accept positive numbers only Is Null OR >=0 Accept date that is not future date Is Null OR <= Date() Accept only “Male” and “Female” Is Null OR "Male" OR "Female"
  • 33. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 33  Creating Query • To manipulate data in the database, e.g. to update a field or delete a record. • Example: Update student name in the first record.  Create  Query Design  Select the table (Students) and click Add.  Next, click Update in Design tab
  • 34. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 34  Creating Query (continued…)  Double click the field (Name) to be updated.  Enter the new value in the Update To box.  Also enter the old value in the Criteria box.  Finally click Run in the Design tab to run the query.
  • 35. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 35  Creating Forms • An object used to create user interface for the database. • Used to access and view data from one or more tables in a database. • Procedure:  Create  Form Wizard  Select a table from the dropdown list and double click the fields which are to be added to the form.
  • 36. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 36  Creating Forms (continued…)  On the next screen, select a layout for the form.  Give the query a name before finishing.  In Form View, the output would be something like this.
  • 37. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 37  Creating Reports • An object used to display data from the database. • Pick data from one or more tables using a query and then create a report. • Example:  A report containing names, addresses and phone number of students.  Create a query that selects names, addresses and phone number of all the students in the table.  Select the query and click on Create  Report
  • 38. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 38  Creating Reports (continued…)  The report opens in Layout mode where its layout can be changed.  Switch to report view and you will see an output like this.
  • 39. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 39  Importing Tables to Database • Import wizard is used to import tables etc. from a .mdb or .accdb database. • EXTERNAL DATA  Access • Locate the existing database file in the wizard. • Select “Import tables, queries, forms, reports, macros and modules”.
  • 40. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 40  Importing Tables to Database (continued…) • Select the tables, queries and forms etc. that are to be imported into the database. • Click OK to finish import. The selected items should appear in your database.
  • 41. Database Design in MS Access Introduction To Computer & ICT – by Dr. Rahman Ali & Asmat Ali 41  Linking Tables with Database • To have one or more tables in multiple databases. • The tables are stored in a single database and are linked to as many databases as needed. • Eliminates the need to enter or update the same data multiple times. • Procedure:  Similar to importing tables to database.  Repeat the process, selecting “Link to data sources by creating a linked table”.  The linked tables appear in the database with a star.
  • 42. References  Ali, R. & Ali, A. (2018). Chapter 7: Databases. Introduction to Computer and ICT – 1st Edition (pp. 117-139). Muhalla Jangi, Qissa Khawani, Peshawar, Pakistan: Al-ilum Publications.