You are on page 1of 72

Database Systems

CS2005-Introduction to
Databases
Dr. Ejaz Ahmed
Spring 2022
About Instructor
1995

Dr. Ejaz Ahmed, PhD


– Former Database Analyst/ Consultant (Abroad)
Experience
2004-2012: Assistant Professor (KFUPM, KSA)
2000-2004: Database Analyst/ Consultant (Canada)
1997-2000: PRAL Software Company (Islamabad)
Software Dev: Caltex, Aramco, GS-Kline, NOVUS, Tax, Med
Research: Hospital Data Integration Proj. DB Workshop
DB Systems, Data Mining, DWH & Software Architecture, IS
Education: Bedfordshire UK, Coventry Uni UK, Punjab Uni,
QAU, FG Sirsyed College, Islamabad Model School G-6/4
In Class …

Dr. Ejaz Ahmed 3


Database
System

• Absolute Grading Course Material


Google Classroom
• Less than equal to 49.5% means F Class code: xywwb6h
• Do not follow up Lectures on YouTube – not authenticated
• Course Material/ slides are sufficient for managing
evaluations: Assignments, Exams & Projects
4
We will follow up

Dr. Ejaz Ahmed 5


Dr. Ejaz Ahmed 6
Lab Project

Dr. Ejaz Ahmed 7


Your efforts’ Level

Dr. Ejaz Ahmed 8


We will enjoy this course!

9
HEC-NCEAC Requirement

Dr. Ejaz Ahmed 10


Recommended Text/ Reference
Books
• Fundamentals of Database Systems
– 5th Edition by Elmasri & Navathe
• Database System Concepts
– 3rd Edition by Abraham Silbershatz, Henery F.
Korth, Sudarshan
• Database Systems: Design, Implementation,
& Management,
– 12th Edition, Coronel/Morris/Rob,
ISBN-13: 978-1-111-96960-8
Dr. Ejaz Ahmed 11
Team
• Class Instructor
– Dr. Ejaz Ahmed (A, B, C)
• Lab Instructors
– Salman Iqbal

Dr. Ejaz Ahmed 12


Use of Gadgets
• Use of Gadgets: Mobile, SMS, WhatsApp,
Internet (Google), DB (Oracle) (~30%)
• Non Gadgets: Book/ Lecture Notes (~70%)

Artifacts of Course are


• Information and understanding: Analysis --> (No Gadget)
• Database Architecture & Components --> (No Gadget)
• Naming Objects & Terminologies --> (No Gadget)
• Model/ Design --> (No Gadgets)
• Implementation (SQL Programming) --> (Yes Gadgets 20%)
• Development for End User (Visual Prog: PHP) --> (Yes Gadgets 5%)
• Applying Design in a Case Study in the Lab (Yes Gadgets DB+PHP+above
artifacts 5%)
• Theory: 3 credits, Lab: 1 Credit (1/3rd of DB course)

Dr. Ejaz Ahmed 13


Keep yourself away from Gadgets!

Dr. Ejaz Ahmed 14


Learning Outcomes
Top Database Groups
• Academia:
– 1) Stanford University, 2) University of Wisconsin,
Madison, 3) University of California, Berkeley, 4)
University of Maryland, College Park, 5)
University of Washington, University of Waterloo
• Research Labs:
– 1) IBM Almaden Research Lab, 2) AT&T
Research Labs, 3) Microsoft Research Lab, 4)
Lucent Technologies.
• Database Products:
– 1) Oracle, 2) IBM DB2, 3) MySQL, 4) Sybase, 5)
MS SQL Server, 6) Informix.

Dr. Ejaz Ahmed 16


Programming Skills
• Front-End Development
– ASP.NET using C#/VB.Net, C++, PHP
• Back-End Development
– MS-Access, Oracle 11g EE, MS SQL Server
• Documentation
– ER-Win, Visio, MS-Word

Dr. Ejaz Ahmed 17


Perception & Approach of a
Student - Comparisons

Core Programming Style


&
Database Applications
(New flavor Visual Programming – Front End)

Video: Visual Analytics - Mastering the Information Age - DB & BI

Dr. Ejaz Ahmed 18


Visual Programming – Front End

Dr. Ejaz Ahmed 19


Overview
• Data: Known facts that can be recorded

• Database: Collection of Integrated data


– Typically models a real-world “enterprise”
– Structured & Un-Structured Models
• DBMS: A software system designed to
store, manage, and facilitate access to
databases.
Dr. Ejaz Ahmed 20
Data vs. Information
• Data: Raw facts/Un-processed information
– But they are building blocks for information

• Information: Data Processed to reveal its


meaning
– Information is meaningful
– In today’s world, accurate, relevant and
timely information is the key to good
decision making
– Good decision making is key to survival in
today’s competitive and global environment

5V’s are Volume/size, Velocity, Veracity, Variety, Value


CCAS: complete, consistent, secure and accurate: Data Integrity
21
Data and Information …
• Data: is known recorded facts which has specific meanings or
interpretation.
– Example: the numbers 10.5, 22, and 119 are data

• Information: is a precise, understandable and specific


representation of data.
– Example: The temperature of room 119 in building 22 is 10.5, is an information

• Knowledge: is something which is derived or inferred from available


information using some level of intelligence.
– Example: Based on experience, the above information can be used to infer that
the room is quite cold and could cause some inconvenience if we work on that
room for a long period of time with out wearing worm clothes.

Dr. Ejaz Ahmed 22


Data vs. Information …

https://www.facebook.com/www.nextgendata.in/videos/587411898430780/
https://www.youtube.com/watch?v=DXhDXpSTykk
Difference

Information & Knowledge

Dr. Ejaz Ahmed 24


What is a System?

A system is a group of elements that are


integrated with the common purpose of
achieving objectives

25
Need for information
• Businesses require decisions
• Decisions require information
• Nature of information varies with the nature
of business and decision
• Planning for business requires information
at regular interval
Create processes, Store data/ information,
Search data, Control data (rules/ best
practices), Access information
Dr. Ejaz Ahmed 26
What is IS?
• Interrelated components are working
together to collect, process, store and
disseminate information

• Every information does not go to every


body
• ESS, DSS, MIS, KWS, OLTP

Dr. Ejaz Ahmed 27


Artifacts for IS?

Web & GUI

Designing/ Modeling

Coding/ Programming

SQL Programming
Database (Data Storage)
Dr. Ejaz Ahmed 28
Attributes of IS
• Easily Availability
• Timelines
• Relevant to decision at hand
• Related to current business needs

Dr. Ejaz Ahmed 29


Exercise
1. Explain, how do you claim ATM & Account
Transaction System is an Information System
for the following users Branch Bank Manager,
other Branch Bank Staff, Account Holders and
Head of all Bank Branches. You must discuss
only for ONE Bank with its own many branches
and ATM locations.
2. Describe the roles of HOD, DIR, Faculty and
Students in terms of "IS“ in NUCES FAST

Open your own account in a bank and use Debit Card for transactions
Dr. Ejaz Ahmed 30
The Need

Dr. Ejaz Ahmed 31


Types of Databases
• Flat Files
• Hierarchical
• Relational
• Object Relational
• Object Oriented
• Web Enabled (Online DBs)
• NoSQL (Unstructured)

Dr. Ejaz Ahmed 32


Files

Dr. Ejaz Ahmed 33


Files and Databases
• Files: A collection of records or documents
dealing with one organization, person,
area, or subject. It could either be:
– Computer files
– Manual files (Paper)
• Database: A collection of similar records
with relationships between records.
– Statistical, Business Data

Dr. Ejaz Ahmed 34


Database vs. File Systems

35
Database
• A database is collection of stored
operational data used by application
systems of some particular enterprise
(C.J. Date)
– Paper Database
• Still contain a large portion of world's knowledge
– File Processing Systems
• Early batch processing of business data
– Database Management Systems (DBMS)
• Will cover in detail
Dr. Ejaz Ahmed 36
File Processing Systems
• Collection of application programs that
performs services for the end-users (e.g.
Reports)
• Each program defines and maintains its
own data

Dr. Ejaz Ahmed 37


File Processing Systems

Dr. Ejaz Ahmed 38


File Processing Systems

Dr. Ejaz Ahmed 39


-- File-Based Approach

User 1 Application
programs
Data

Application Data
User 2 programs

Dr. Ejaz Ahmed 40


Limitations of File-based Approach
• Separation and isolation of data
– Each program maintains its own set of data. Users of one
program may be unaware of potentially useful data held by
other programs.

• Duplication of data
– Same data is held by different programs. Wasted space
and potentially different values and/or different formats for
the same item.

• Atomicity of updates
– Failure may lead database to an inconsistent state with
partial updates carried out
– E.g. Transfer of funds from one account to another should
either be complete or incomplete, no in-between state

Dr. Ejaz Ahmed 41


Limitations of File-based Approach
• Data dependence
– File structure is defined in the program code with path.
– Data in one file cannot be dependent on other file’s data
• Incompatible file formats
– Programs are written in different languages, and so cannot
easily access each others files.
• Integrity Problems
– Integrity constraints (e.g. account_balance > 0) became
“buried” in program code rather than being stated explicitly
– Hard to add new constraint or update existing one
– File in the folder cannot keep such conditions
Dr. Ejaz Ahmed 42
Limitations of File-based Approach
• Fixed Queries/Proliferation of
application programs
– Programs are written to satisfy particular functions. Any
new requirement needs a new program.

• Data Redundancy and Inconsistency


– Multiple file formats, and duplication of information in
different files

• Difficulty in Accessing Data


– Need to write a new program for accessing new data
Dr. Ejaz Ahmed 43
Database Approach
• Overcomes problems associated with file-
system based approach
• Central repository of shared data
• The database holds not only the data but also
a description of the data.
– Data dictionary, System Catalogue, or metadata
• A central location where data descriptions are stored.
• Data about data
– Program-data independence

Dr. Ejaz Ahmed 44


System Catalog
• Repository of information (metadata) describing the
data in the database
• Typically stores:
– Names of authorized users
– Names of data items in the database (Tables, views, Triggers)
– Constraints on each data item
– Data items accessibility by a user and type of access etc.
• Used by modules such as Authorization control and
integrity checker
• Oracle contains some of catalogues/ dictionary views
User_Constraints, All_Objects, All_Users etc.

Dr. Ejaz Ahmed 45


Advantages of the Database Approach
• Program-data independence
– The separation of data descriptions from
the application programs that use the data.
– Allows the data to change without
changing the application programs.
• No or Planned data redundancy
• Improved data consistency
• Improved data sharing
• Enforcement of standards

Dr. Ejaz Ahmed 46


DBMS – a Package

Database System

Data
DBMS
employee,
order, inventory,
and
customer data

47
Database Management System
(DBMS)
DBMS is a software package that enables user to create and
maintain databases. It facilitates:
– Defining a database that involves specifying the data
types, structures, and constraints for the data to be
stored in the database.
– Constructing a database which is the process of storing
the data.
– Manipulating a database such as functions of querying
and sharing the database objects, updating the
database, and generating reports from the data.
• Database and DBMS software together constitute a
database system.
Dr. Ejaz Ahmed 48
Examples DBMS

– Oracle
– IBM DB2
– Ingress
– Teradata
– MS SQL Server
– MS Access
– Amazon Aurora
– MySQL etc.

Dr. Ejaz Ahmed 1-49


Database Systems-Applications
• Purchases from the supermarket
• Purchases using your credit card
• Booking a holiday at the travel agents
• Using the public library
• Taking out insurance
• Renting a video
• Using the Internet
• Studying at university (Academic & Financial)
• Bank’s Transaction System
Dr. Ejaz Ahmed 50
Database Management System
(DBMS) Features
• A Software Package that enables users to
define, create, maintain, and control access
to the database.
– Data Definition Language (DDL)
– Data Manipulation Language (DML)
– Control access (DCL):
• Security, integrity, concurrent access, recovery, support for
data communication, etc.
– Utility services (DCL)
• File import/export, monitoring facilities, code generator,
report writer, etc.
• Support Ad Hoc queries
Database Languages are DML, DDL, DCL in SQL.
51
DBMS Architecture

Form Processing & Report Processing Applications are build by using VB, DOT Net
or PHP programming. Reports can be developed by using Crystal Reports tool.
Query Processing can be managed by using vendors SQL tool or 3rd party tools such
As TOAD, SQL Developer etc.
Dr. Ejaz Ahmed 52
Data Accessing using DBMS

2-tiers & 3-tiers Architectures

Dr. Ejaz Ahmed 53


Forms, Reports & Queries

Dr. Ejaz Ahmed 54


Database Management
System
A software system that is used to create, maintain, and provide

controlled access to user databases

Order Filing
System

Invoicing Central database


DBMS
System
Contains employee,
order, inventory,
pricing, and
Payroll
customer data
System

DBMS manages data resources like an operating system manages hardware resources
Dr. Ejaz Ahmed 55
Database System Environment

Dr. Ejaz
56Ahmed
DBMS Benefits
• Minimal data redundancy
• Consistency of data
• Integration of data
• Sharing of data
• Ease of application development
• Uniform security, privacy and integrity controls
• Data accessibility and responsiveness
• Reduced program maintenance
• Data independence
Dr. Ejaz Ahmed 57
DBMS related Applications
• SQL
• Forms/ Reports
• Web/ Portal
• GUI Client-Server (VB, C++, Java, Mobile)
• SAP/ OracleApps
• BI Applications (SAS, OracleWarehousing)
• Case Tools (Toad Modeler, Enterprise
Architect, VISIO etc)
Dr. Ejaz Ahmed 58
Components of DBMS
Environment

Dr. Ejaz Ahmed 59


Components of DBMS
Environment
• Hardware
– Can range from a PC to a network of
computers
• Software
– DBMS, operating system, network software (if
necessary) and also the application programs
• Data
– Used by the organization and a description of
this data called schema
Dr. Ejaz Ahmed 60
Components of DB Environment …
• Procedures
– Instructions and rules that should be applied
to the design and use of the database and
DBMS
• People
–…

Dr. Ejaz Ahmed 61


Database Professionals
• Database implementers
– Build modules that go inside the DBMS
• Database application developers
– Build application that run on top of the DBMS,
and are used by end-users to interact with their
data.
• Database Administrators
– Create database schema
– Maintain and tune the DBMS engine
– Maintain and tune the data in the DBMS
– Corporations need them ($$$)

Dr. Ejaz Ahmed 62


Roles/ Jobs in the Database
Environment
• Data Administrator (DA)
• Database Administrator (DBA)
• Database Designers (Logical and Physical)
• Applications Programmer
• Database Developer
• Database Analyst
• End users (Naive and sophisticated)

Dr. Ejaz Ahmed 63


Forms & Reports

Dr. Ejaz Ahmed 64


-- Database Approach

User 1 Application
programs
DBMS
Database or
Data

User 2 Application
programs

Dr. Ejaz Ahmed 65


Interaction of DBMS with DB Files

Dr. Ejaz Ahmed 66


Evolution of DB Systems

Dr. Ejaz Ahmed 67


Dr. Ejaz Ahmed 68
Types of DBs NoSQL, Cloud
• SQL DB are structured DBs (DBMS)
• NoSQL database is
– a next-generation DB
– used for big data, mainly retrieval purpose
– horizontally scalable
– Apache Cassandra, Apatchi HBase, Google
Bigtable and MongoDB
• Graph, Document, Key-value and Column
Database are also known as NoSQL
• Cloud DBs MS Azure & Amazon AWS
69
Architectures
SQL Databases NoSQL Databases

Relational Column Family Key-Value


Key Value

Key Value

Key Value

Key Value
Analytical (OLAP)
Graph
Document

Dr. Ejaz Ahmed 70


• To get A+, be above 85% (Absolute)
• Less than 49% means F
• Absolute Grading
• Do not follow up Lectures on YouTube
• Course Material/ slides are sufficient for managing
71
evaluations: Assignments, Exams & Projects
End

Dr. Ejaz Ahmed 72

You might also like