[go: up one dir, main page]

0% found this document useful (0 votes)
8 views32 pages

week 9 sql (2)

The document provides an overview of file processing systems and introduces the concept of databases and database management systems (DBMS). It highlights the advantages of using a database approach, such as data sharing, controlled redundancy, and better data integrity, and discusses SQL as a tool for managing databases. Additionally, it touches on NoSQL databases and the concept of Big Data, emphasizing their importance in handling large volumes of information.

Uploaded by

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

week 9 sql (2)

The document provides an overview of file processing systems and introduces the concept of databases and database management systems (DBMS). It highlights the advantages of using a database approach, such as data sharing, controlled redundancy, and better data integrity, and discusses SQL as a tool for managing databases. Additionally, it touches on NoSQL databases and the concept of Big Data, emphasizing their importance in handling large volumes of information.

Uploaded by

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

Fundamentals of Information Technology (CT-174)

Introduction to Database
Week 9

Miss Saadia Arshad


File Processing System
▸ A file processing system is a method for storing, reading, writing, and
modifying data in files.

▸ A collection of application programs that perform services for the end-

users such as production of reports.

▸ Each program defines and manages its own data.


Example:
Library Examination Registration

Library Examination Registration


Applications Applications Applications

Library Examination Registration


Data Data Data
Files Files Files
Example
Library Examination Registration
Reg_Number Reg_Number Reg_Number
Name Name Name
Father Name Address Father Name
Books Issued Class Phone
Fine Semester Address
Grade Class
Example
Library Examination Registration
Problems
Reg_Number Reg_Number Reg_Number Duplication / Redundancy
Name Name Name Separation / Limited Sharing
Father Name Address Father Name
Class Dependence
Books Issued Phone
Fine Semester Address
Grade Class
Data Dependency
▸ Each application programmer maintains their own data.
▸ Each application program must have its own processing routines for
reading, inserting, updating and deleting data.
▸ Lack of coordination and central control.
▸ Non-standard file formats.
Data Redundancy
▸ Waste of space to have duplicate data
▸ Causes more maintenance headaches
▸ When data changes in one file, could cause inconsistencies (Vulnerable
to Inconsistency).
▸ Compromises data integrity (data reliability).
Solution – Database Approach
▸ Central repository of shared data.
▸ Data is managed by a controlling agent.
▸ Stored in a standardized, convenient form.
Database
▸ A database is an organized collection of structured information, or
data, typically stored electronically in a computer system.
▸ A database is usually controlled by a database management system
(DBMS).
Advantages of Database Approach

Library Examination Registration

Library Examination Registration


Applications Applications Applications

Database
Management
System

- Data Sharing - Data Independence


- Controlled Redundancy University
Students - Better Data Integrity
Database
Database Management System – DBMS
▸ A software system that enables users to define, create, maintain, and
control access to the database.
▸ Database Management Systems (DBMS) are software systems used to
store, retrieve, and run queries on data.
▸ A DBMS serves as an interface between an end-user and a database,
allowing users to create, read, update, and delete data in the database.
DBMS Examples
Structured Query Language - SQL
▸ SQL stands for Structured Query Language.

▸ It is used for storing and managing data in a database.

▸ It enables a user to create, read, update and delete relational databases and
tables.

▸ It uses English-like statements that are easy to understand.

13
What Can SQL do?
▸ SQL can execute queries against a database.
▸ SQL can retrieve data from a database.
▸ SQL can insert records in a database.
▸ SQL can update records in a database.
▸ SQL can delete records from a database.
▸ SQL can create new databases.
▸ SQL can create new tables in a database.
▸ SQL can create views in a database.
▸ SQL can set permissions on tables etc.

14
SQL Commands
▸ SELECT - extracts data from a database

▸ UPDATE - updates data in a database

▸ DELETE - deletes data from a database

▸ INSERT INTO - inserts new data into a database

▸ CREATE DATABASE - creates a new database

15
SQL Commands
▸ ALTER DATABASE - modifies a database

▸ CREATE TABLE - creates a new table

▸ ALTER TABLE - modifies a table

▸ DROP TABLE - deletes a table

▸ etc.

16
SQL Queries
▸ Suppose we have data of people who shopped from an online store stored in a
Table called Customers.

CustomerID CustomerName Address City

1 Ali ABC Street Lahore

2 Ahmed XYZ Street Karachi

3 Bisma GHI Lane Multan


4 Faraz RTY Road Islamabad

17
SQL Queries- Select
▸ Write a query to show all entries of the table
SELECT * FROM Customers;
Output:

CustomerID CustomerName Address City

1 Ali ABC Street Lahore

2 Ahmed XYZ Street Karachi

3 Bisma GHI Lane Multan


4 Faraz RTY Road Islamabad
18
SQL Queries - Select
▸ Write a query to display customer name and city from the table
SELECT CustomerName, City FROM Customers;
Output:

CustomerName City
Ali Lahore
Ahmed Karachi
Bisma Multan
Faraz Islamabad

19
SQL Queries - Select
▸ Write a query to display all customers from Multan city

SELECT * FROM Customers


WHERE City=‘Multan';
Output:

CustomerID CustomerName Address City


3 Bisma GHI Lane Multan

20
SQL Queries - Insert

INSERT INTO Customers (CustomerName, Address, City)


VALUES (‘Shehzad’, ‘lane345 street 6’, ‘Multan’);

21
SQL Queries - Insert

INSERT INTO Customers (CustomerName, Address, City)


VALUES (‘Shehzad’, ‘lane345 street 6’, ‘Multan’),
VALUES (‘Ahsan’, ‘House no 45 street 9’, ‘Karachi’);

22
SQL Queries - Delete
DELETE FROM table_name WHERE condition;
Example:
▸ DELETE FROM Customers WHERE CustomerName= ‘Ahsan';
▸ DELETE FROM Customers; (deletes all rows)
▸ DROP TABLE Customers; (delete the table completely)

23
SQL Queries - Update
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

Example:
▸ UPDATE Customers
SET CustomerName = Ahmed Ali', City= ’Islamabad'
WHERE CustomerID = 2;

24
NoSQL Databases
▸ NoSQL, or "not only SQL" or "non-SQL", is a database
design approach that stores and retrieves data in a non-
tabular format.
▸ They are often used for large data volumes, real-time web
applications, and big data.
▸ Example: MongoDB

28
NoSQL Features
▸ No tables: NoSQL databases don't use tables like traditional
databases do. Instead, they use other structures like documents, key-
value pairs, or graphs.
▸ Flexibility: NoSQL databases can handle different types of data, like
text, images, or videos, and can store them in a flexible way.
▸ Scalability: NoSQL databases are designed to handle large amounts
of data and scale easily, making them perfect for big data and real-
time applications.

29
NoSQL Real World Example
▸ Social media: NoSQL databases are used to store user
data, posts, and comments etc.

30
Big Data
▸ Big Data refers to a huge amount of information that is too large and
complex to be processed by traditional data processing tools.
▸ Big Data is generated from a diverse range of sources like social
media platforms (Facebook etc.), Online transactions (including e-
commerce and digital marketplaces etc.
▸ This data is then stored, processed, and analyzed to gain insights,
make predictions, and inform decisions, driving business, innovation,
and progress.
▸ The five characteristics of big data are often described as the 5 V’s.

31

You might also like