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

Lecture 1 - Introduction To Databases

This document provides an introduction to the CENG375 Introduction to Database Systems course. It outlines the course content which covers entity-relationship modeling, the relational database model, SQL, and database normalization. It lists the required textbook and notes that slides and exercises will be provided on Google Classroom. It also provides some basic rules and expectations for the course and concludes with an introduction to the fundamentals of database systems and management.

Uploaded by

hadi.slim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Lecture 1 - Introduction To Databases

This document provides an introduction to the CENG375 Introduction to Database Systems course. It outlines the course content which covers entity-relationship modeling, the relational database model, SQL, and database normalization. It lists the required textbook and notes that slides and exercises will be provided on Google Classroom. It also provides some basic rules and expectations for the course and concludes with an introduction to the fundamentals of database systems and management.

Uploaded by

hadi.slim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

CENG375

Introduction to Database Systems


Spring 2024

1
Course content

O This course offers an introduction to the design and programming


of database systems, it covers:
O The ER (Entity-Relationship) approach to data modeling
O The relational model of database management systems (RDBMS)
O The use of relational algebra and query languages such as SQL to
create, modify or query the database
O Database normalization

2
Course materials
•Textbook: Database Systems: The complete book. (Second) by
Garcia Molina, Ullman and Widom, ISBN: [9780131354289].
Pearson
•Slides: found on Google Classroom
•Exercises and labs: to be published on Google Classroom
•Programming tools: XAMPP, NetBeans with Java JDK

3
Some rules
• You should constantly check your email/google classroom announcements.
• “Not seeing your email” is not a valid excuse. You have a smartphone.
• Emails should be sent to me in English or Arabic. “Arabizi” emails won’t get
a reply.

4
CENG375
Introduction to Database Systems

Chapter 1
World of Database Systems

5
Some questions

• What is in your opinion the best way to organize the data and where?
• How will we search the data to find what we need?

6
Database World
• Database is nothing more than a collection of information that exists over
a long period of time, often many years.
• Databases are used to maintain and manage Data found in:
• Websites
• Corporations
• Research institutes
• Companies

7
Real life examples

Databases are everywhere:


You’re using a database
system if you
- Enroll in a course
- Transfer money
- Shop on Amazon
- ….

8
Database World
• Databases are involved with almost every business in the world
• Almost any website has a database behind the scene that serve up the
information you request such as Facebook to store your comments,
statuses, and friends
• Corporations maintain all their important records in databases

9
Database Management System
(DBMS)
• The power of databases comes from a powerful software that has

developed over several decades and is called a Database


Management System or DBMS.

• A DBMS is used for creating and managing large amounts of data

efficiently and allowing it to persist over long periods of time,


safely.

10
DBMS properties
1.Allows users to create new databases and specify their
structure
2.Allows users to Query the data and modify it (CRUD)
3.Supports storage of large amounts of data over a long
period of time
4.Ensures durability and recovery
5.Controls access to databases: Assign rights to users
6.Allows execution of transactions: isolation and atomicity
11
Database Management System
• A DBMS allows users to query and modify data:
• Example of a user: A java application, a web application, etc..
• Query data: Retrieve and read data from the database
• Modify data: Insert new data (or Create), update and delete
• Acronym CRUD: Create, read, update and delete

12
Evolution of DBMS
1 Early Database Systems
• Evolved from file systems and date back to 1960’s
• Not all DBMS properties are offered
• First important applications of DBMS:
• Banking systems
• Airline Reservation systems
• Corporate record keeping

They all use graph tree structure standardized in CODASYL


(Committee on Data systems and Languages)

13
Evolution of DBMS
2 Relational Database Systems
• Relational Model was born in 1970 by a famous paper written by Ted Codd
• Data organized as tables called relations
• The programmers are not involved with the storage structure
• Queries are expressed in a high-level language called SQL

Relation:
Title Year Genre Director
Movies
James
Tuple 1 Avatar 2009 Adventure
Cameron

W Halla2 la
Tuple 2 2011 Drama/comedy Nadine Labaki
wein?
14
Example of a relational database School
• A relational database is a collection of relations (Tables)
Relation Teachers
TeacherID name age
1 John smith 33
2 Jane white 40

Relation Courses Relation Teach


courseCode CourseName courseCode TeacherID
CENG375 Database systems CENG375 1
CENG380 Microcontrollers CENG375 2
CENG380 1

In the above example, the database school has 3 tables. in Table teachers, we have 2 tuples denoting 2
teachers, john and jane. In table courses, we have 2 courses, and in table teach, we have 3 tuples that tell us
that john teaches ceng375 and ceng380, while jane only teaches 375
15
Evolution of DBMS
• Due to advances in technology, we can store gigabytes on single disks
now
• DBMS can be run on personal computers now

16
Evolution of DBMS

3 NoSQL database systems


• NoSQL (“non-SQL” or “not only SQL“) databases store data in forms
different from relational tables.
• The four main types of NoSQL databases:
• Document databases
• Key-value stores
• Column-oriented databases
• Graph databases

17
Evolution of DBMS
• Examples of document databases: JSON and XML

18
Relational data versus
document store data

19
Evolution of DBMS
• When to use a relational (SQL) database?
• Structured data where relationship between entities is important: Relational databases
require one to follow a schema
• When to use a non-relational (NoSQL) database
• If the data you are storing needs to be flexible in terms of shape or size, or if it needs to
be open to change in future
• NoSQL database systems accept some duplication of data
• Other comparison criteria: Scalability and data storage, complexity and speed of
queries execution, reliability, …

• In this course, we will discover relational databases


This
design and implementation. course

20
The SQL language
•SQL is the most important query language based on
relational model.
•It’s used to issue commands to the DBMS
•SQL = Structured Query Language
•The SQL standard is around since the 1970s
•Lots of features, we will only see a subset

21
SQL command types
• DDL: Data definition language
• Used by database administrator to define the structures of a database like This
schema, tables, constraints, etc. course

• DML: Data manipulation language


• Does not affect the schema of the database but may affect its contents
• Used by users/application to implement CRUD operations This
course
• TCL: Transaction control language
• Groups SQL commands (transactions)
• DCL: data control language
• Assign data access rights

22
• The key distinction is that the DDL
command is used to create a database
schema, while the DML command is
used to retrieve data from the database
and to modify the content of the table
(data).

23
Basic DDL Commands in SQL
•CREATE: to define new tables (relation schemas)
•DROP: to remove tables from the database
•ALTER: to change the definitions of existing tables (to change
relation schema)
•Other features of DDL: Specify constraints

ALTER example:
TeacherID name birthdate
age phone

24
Basic DML Commands in SQL
•INSERT (CREATE new data records): to add new rows to tables
•UPDATE: to change the “state” (the value) of rows.
•DELETE: to remove rows
•SELECT (READ): a query command that retrieves data from the
database
Acronym CRUD is used to refer to DML operations: Create, Read,
Update, and Delete
TeacherID name birthdate
age phone
1 John Smith
W Smith 1990 71777675
81999999
2 Jane White 1983 71888888

25
Concept of a query

26
Overview of DBMS
• A DBMS has several components that work together to execute SQL commands

27
The Query Processor
✓ Translates the query into a query plan which is a sequence of
operations to be performed on the data.

✓ Executes each of the steps in the chosen query plan and


interacts with other components.

28
Storage manager

• Data access: keeps track of the location of files on the disk and
obtains the blocks of data upon request.
• Buffer manager: A database buffer is a memory location used by a
DBMS to temporarily hold data that has recently been accessed or
updated in the database.
• It acts as a link between the programs accessing the data and the
physical storage devices.
• The buffer is essential for enhancing the DBMS's overall performance:
• Caching frequently requested data in memory decreases the
frequency of disc I/O operations, accelerating query and
transaction processing. 29
Transaction manager

• It accepts transaction commands from app.

• It insures atomicity and isolation of transactions (start and


end of transaction)

30
Transaction manager

The ACID concept:


• A: Atomicity → Either all or none of the transaction operation is done.
• C: Consistency → A transaction transfers the database from one
consistent (correct) state to another consistent state.
• I: Isolation → Each transaction should appear as if no other transaction is
executing at the same time. Although multiple transactions execute
concurrently, it must appear as if the transaction are running serially
(one after the other). Locks are used for that purpose.
• D: Durability → The results of transactions are permanent i.e. the result
will never be lost with subsequent failure.
31
Logging and recovery manager

• Every change in the database must be logged.

• In case of crash, recovery manager will examine logs and


recover the database.

32

You might also like