0% found this document useful (0 votes)
13 views55 pages

Lecture 1

DATABASE

Uploaded by

zainjutt765079
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views55 pages

Lecture 1

DATABASE

Uploaded by

zainjutt765079
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 55

Introduction to Database

Systems
SPRING 2025
Slide
1-2

Introduction

 Instructor: Ms. Ayesha zaheer


 BSCS FAST(NUCES)
 MSCS LUMS
 Email: [email protected]

 Office Building A, F303, Cabin 1

 Office hours Monday and Wednesday 11:00 am – 01:00 pm


Slide
1-3

Course Books

 Text Book:
 Ramez Elmasri, Fundamentals of Database Systems (7th /8th Edition)
 Link for Database books:
 https://onlinepgc-my.sharepoint.com/:f:/g/personal/sadaf_baloch_ucp_edu_pk/EurZuqbVjzRLsZ2gVhpslfcBLN4Dbk
-X6R6GJtWBkShHkQ?e=6nIHdh

 Marks Division:
 Assignments (15%)
 Quizzes (15%)
 CP (10%)
 Mid Term (20%)
 Final Term (40%)
Slide
1-4

Announcements & Plagiarism

 Make sure you check your email and announcement on portal regularly.
I keep on posting announcements for the deadlines.

 Plagiarism Policy will be strictly applied.

 No retakes
INTRODUCTION TO
DATABASES
Lecture 1
6
Database

 Database
 The collection of data

 Collection of related data


Slide 1-7

Properties of Databases

A database has the following implicit properties:

 A database represents some aspect of the real world,


sometimes called the mini world. Changes to the miniworld
are reflected in the database.

 A database is designed, built, and populated with data for a


specific purpose. It has an intended group of users and some
preconceived applications in which these users are
interested.
Slide
1-8

Some examples

Emergence of web interfaces provided direct database interaction. Data on


website is directly fetched from the database.

Examples:
 Banking:
 For customer information, accounts, loans and banking transactions etc.
 Airlines:
 For reservations and schedule information.
 Universities:
 For student information, course registration and grades.
 An example of a large commercial database is Amazon.com
Slide
1-9

DBMS

 Database Management
System
 Collection of interrelated
data and a set of programs
to access those data.

 Goal of DBMS
 To provide a way to store
and retrieve database
information that is both
convenient and efficient.
Slide 1-10

DBMS Functionality (Why to use DBMS)

 Define a database in terms of data types, structures and constraints

 Construct or Load the Database on a secondary storage medium

 Manipulating the database by querying, generating reports,


insertions, deletions and modifications to its content

 Sharing by a set of users and programs but keeping the data


consistent at the same time.

 Security measures to prevent unauthorized access.

 Presentation and Visualization of data


Slide
A simplified database system 1-11

environment
12
Some points to ponder

 Why are we using DBMS?


 What we have been using till now?
 Why are we moving from traditional file system to database system?
13

Issues in filling
system.
14
Activity Time

 Lets see an excel sheet holding some records.


 Please see if you find out any problems in the given excel sheet.
 Problems related to :
 The current state of the file.
 If you want to add some other rows.
 If you want to delete some existing rows.
 If you want to update some information in the existing rows.
15
16
1. Redundancy

 Duplicates of data
 Same piece of information present at multiple locations
17
2. Inconsistency

 Different information related to same entity in different/same files.


 Data can be inconsistent if:
 Changes are made to one place and not in another
 There is a typo
 Data is present in different formats
 Data redundancy can cause data inconsistency
18
3. Data Isolation & Data Mapping

 Data is scattered in various files and may be in different formats.


 Writing new programs for different files may be difficult.
 No link between the files
 Changes in one cannot be reflected in another
19
4. Integrity Problems

 Age must be under 60


 Account balance must not be negative
 Balance must be 5000 or greater. If this rule changes, changes would
be done at every check.

 How to handle all these?


20
5. Atomicity

 For example: We are transferring some amount to another account and


there is a power outage. What will happen?
Slide
Metadata/Data Dictionary/Catalog 1-21
22

Design phases
of databases
23
How is a house constructed?

 If you want to build a house what steps will you follow?


 We will give our requirements to the architect.
 He will show us some paperwork i.e. a map or a 3d model.
 Then the foundations are laid and grey structure is built according to the
preferred material.
 We then finalize about the finishing and furnishing.
Slide 1-24

Design Phases of Database

1. Requirement Definition and analysis


 Design of a new application for an existing database
OR

 Design of a new database

2. Conceptual Design
- These requirements are documented in detail to form a conceptual design
- Conceptual design can be represented and manipulated using some
computerized tool so that it can easily be maintained, modified and transformed to database
implementation.
Example: Entity Relationship Model
Slide 1-25

Design Phases of Database

3. Logical Design
 Conceptual design is transformed into logical design
 Logical design can be expressed in a data model
 Example: Relational Data Model

4. Physical Design
 In this stage further specifications are provided for storing and
accessing the database.
 Database design is implemented , populated with actual data
and continuously maintained to reflect the actual state of
miniworld.
Slide
2-26

Conceptual data model – ER Diagram


Slide
2-27

Logical data model – Relational model


Slide
2-28

Physical Model
Strong Entity vs Weak Entity

 An entity is strong if it can independently exist

 An entity is weak when its existence depends on another entity.


Example of weak entity

 Child can't exist without parent


 Section can't exist without class
 Account can't exist without bank

 Representation

Section
Attributes representation in ERD
(Oval)
 Properties of an entity
id
Student

name
Types of an attribute

 Types of attributes

 Key attribute
 Composite attribute
 Derived attribute
 Simple attribute
 Multivalued attribute
Attributes

Month

date
DOB
yea
Age r
CGPA

Hobby
Roll No Student
Types of keys
Relationship representation in ERD
(Diamond)

Student Enrolls Course


in

Is
 Please note: Readability is Left to Right & Top to bottom taught
by

Teacher
Wrong structure

Teacher

Is
taught
by

Course Enrolls Student

 Please note: Readability is Left to Right & Top to bottom


 Correct it.
Constraints on Relationship

Cardinality Participation
 One to many (1:N)  Total Participation
 One to one (1:1)  Partial participation
 Many to many (M:N)
Relationship: cardinality

Faculty Works Department


for

Faculty Courses
Teaches

Faculty Is head Department


of
Relationship: cardinality

 1:M
1
M
Faculty Works Department
for
 M:N
N M
Faculty Courses
Teaches
 1:1

1 1
Faculty Is head Department
of
Relationship: Particitaion

 Total or partial

works Department
Faculty

Faculty Teaches Courses

Faculty Is head Department


of
Relationship: cardinality and
Participation
 1:M
M 1
Department
Faculty works

 M:N
M N
Faculty Teaches Courses

 1:1
1
1 Is head
Faculty Department
of
Attributes of relationship

 A relationship can have attributes:


 For example, grade of enrolls
 Its value for each relationship instance describes the grade a student takes
when he is enrolled in a course.
 A value of Grade depends on a particular (Student, Course) combination

Students Course
Enrolls

Grade
Recursive Relationship: Rolenames

 Employee is supervisor of other employees

supervisee
Employee

Supervisor

1 is M
supervis
or of
Identifying relationship

Employee has Medical


Dependent have
Reports

 Relationship between a strong and weak entity is identifying.

 Why it would be needed?


Ternary relationship
Activity: Design an ERD

 The company is organized into departments. Each department has a unique name, a
unique number, and a particular employee who manages the department. We keep
track of the start date when that employee began managing the department. A
department may have several locations.
 A department controls a number of projects, each of which has a unique name, a
unique number, and a single location.
 We store each employee’s name, Social Security number,2 address, salary, gender ,
and birth date. An employee is assigned to one department, but may work on several
projects, which are not necessarily controlled by the same department. We keep track
of the current number of hours per week that an employee works on each project. We
also keep track of the direct supervisor of each employee (who is another employee).
 We want to keep track of the dependents of each employee for insurance purposes.
We keep each dependent’s first name, gender, birth date, and relationship to the
employee.
Mention cardinality & participation
Identify Weak entities
Identify relationship attributes

 The company is organized into departments. Each department has a unique name, a
unique number, and a particular employee who manages the department. We keep track
of the start date when that employee began managing the department. A department may
have several locations.
 A department controls a number of projects, each of which has a unique name, a unique
number, and a single location.
 We store each employee’s name, Social Security number,2 address, salary, gender , and
birth date. An employee is assigned to one department, but may work on several projects,
which are not necessarily controlled by the same department. We keep track of the current
number of hours per week that an employee works on each project. We also keep track of
the direct supervisor of each employee (who is another employee).
 We want to keep track of the dependents of each employee for insurance purposes. We
keep each dependent’s first name, gender, birth date, and relationship to the employee.
48

Self study USERS OF DATABASE


SYSTEM
topics WHEN NOT TO USE A DB
Slide 1-49

Database Users

Users may be divided

1. Actors on the Scene :


Those who actually use and control the content

2. Workers Behind the Scene:


Associated with the design, development, and operation of the DBMS
software and system environment. These persons are typically not
interested in the database content itself.
Slide 1-50

Database Users

Actors on the scene


– Database administrators: responsible for
authorizing access to the database, for co-
ordinating and monitoring its use, acquiring
software, and hardware resources, controlling
its use and monitoring efficiency of operations.
– Database Designers: responsible to define
the content, the structure, the constraints, and
functions or transactions against the database.
They must communicate with the end-users
and understand their needs.
– End-users: they use the data for queries,
reports and some of them actually update the
database content.
Slide 1-51

Categories of End-users

 Casual : access database occasionally


when needed
 Naïve or Parametric : they make up
a large section of the end-user
population. They use previously well-
defined functions in the form of
“canned transactions” against the
database. Examples are bank-tellers or
reservation clerks who do this activity
for an entire shift of operations.
Slide 1-52

Categories of End-users

• Sophisticated : these include business


analysts, scientists, engineers, others
thoroughly familiar with the system
capabilities. Many use tools in the form of
software packages that work closely with the
stored database.
• Stand-alone : mostly maintain personal
databases using ready-to-use packaged
applications. An example is a tax program
user that creates his or her own internal
database.
Slide 1-53

Categories of End-users

• Application Programmers/ Software


Engineers
 Determine the requirements of end users,
especially naive and parametric end users, and
develop specifications for standard canned
transactions that meet these requirements.

 Application programmers implement these


specifications as programs; then they test,
debug, document, and maintain these canned
transactions.
Slide
1-54

Workers Behind the Scene

 DBMS system designers and implementers


 Design and implement the DBMS modules and interfaces as a software package.

 Tool developers
 Design and implement tools—the software packages that facilitate database
modeling and design, database system design, and improved performance.

 Operators and maintenance personnel


 They are responsible for the actual running and maintenance of the hardware
and software environment for the database system.
Slide 1-55

When not to use a DBMS

 Main
inhibitors (costs) of using a
DBMS:
– High initial investment and possible need
for additional hardware.
 Whena DBMS may be
unnecessary:
– If the database and applications are
simple, well defined, and not expected to
change.
– If access to data by multiple users is not
required.

You might also like