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

Databases

Uploaded by

124khan667
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Databases

Uploaded by

124khan667
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Databases

Your Task
Link : https://www.youtube.com/watch?v=UsBJ9l5tajA

1. Why we need to store data in


files? What issues we faced when
we use file systems for saving our
data?
2. What is database? Why we use it?
3. Advantages of Database and
Disadvantages of File System
4. What is DBMS?
Write program(s) 
 Take input: data of 500 students
◦ ID, Name, Age, Address, Registration date, program, Courses,
Intermediate result, fee status.

 Take input: data of 50 instructors


◦ ID, Name, Address, Qualification, Experience, Salary, Courses.

 Take input: data of 25 courses


◦ Code, Name, Registration, Start/End Dates, instructor, students,
program.

 University wishes to store, access all data from various


dimensions…

 University wishes to store transactions …


 50 students submitted their fees on Dec 12th 2013.
Issues Faced…
Data are not stored on disk;
 Programmer defines both logical data
structure and physical structure, such
as storage structure, access methods,
I/O modes etc.
One data set per program: high data
redundancy.( data redundancy is
practice of keeping data in two or more
places within a database or data
storage system.)
There is no persistence;
One Solution: Files
Data are stored in files with
interface between programs and
files.

Requires extensive programming.

Various access methods exits,


e.g., sequential, indexed, random
Issues Faced…
Separation and isolation:
◦ Each program maintains its own set of
data, users of one program may not aware
of holding or blocking by other programs.
Duplication:
◦ Same data is held by different programs,
thus, wastes space and resources.
High maintenance costs such as
ensuing data consistency and
controlling access
Weak security
Ultimate Solution:
Databases…
Ultimate Solution:
Databases…
What is a Database???
Database is a collection of
information and a means to
manipulate data in a useful way,
which must provide
◦ proper storage for large amounts of
data
◦ easy and fast access and
◦ facilitate the processing of data
Why use a Database???
 Databases can store very large numbers of records
efficiently (they take up little space).
 It is very quick and easy to find information.
 It is easy to add new data and to edit or delete old
data.
 Data can be searched easily, e.g. 'find all Ford cars'.
 Data can be sorted easily, for example into 'date first
registered' order.
 Data can be imported into other applications, for
example a mail-merge letter to a customer saying
that an MOT test is due.
 More than one person can access the same database
at the same time -multi-access.
 Security better than files.
HOW???
Database Management Systems

Database Management System


(DBMS) is a set of software that is
used to define, store, manipulate
and control the data in a
database.
DBMS…
 They provided an efficient way to program complex
applications without the cost of rewriting the data
access and retrieval functions for each application.

 Theyprovided a relatively simple, standard way to


share data among multiple applications and multiple
users.

 They created specialized user-oriented languages.

 They provided standard interfaces for the data


communications programs so that the online
transaction processing applications could be
efficiently built, tested, and maintained (both in time
and cost).
Database Model: Two
Dimensional
“EachFile is conceptually a 2
Dimensional Table”…Edgar F.
Codd

A DB is collection of Tables 
Buzz Words/Key
Words/Terms…
Entit
Attribut y
e

Tuple/
Recor
d
Buzz Words/Key
Words/Terms…
Ke ary
im
y
Pr
Primary key and foreign
key
Primary key: It is uniquely
identified attribute.
Foreign key: It is a column in a
database that
(e.g. table_1.column_a) are linked
to a column in a different table


Accessing Data in a DB
Structured Query Language (SQL)
◦ A special purpose programming
language

SELECT ID, LastName, FirstName


FROM Employees
WHERE ID = 123;
Accessing Data in a DB
SELECT ID, LastName, FirstName
FROM Employees
WHERE ID = 123;
Accessing Data in a DB
SELECT FirstName, BirthDate
FROM Employees
WHERE LastName = “Kay”;
Accessing Data in a DB
SELECT FirstName, BirthDate
FROM Employees
WHERE LastName = “Kay”
AND PayRate = “$17.80”;
Accessing Data in a DB
Order by keyword is used to sort the record in
ascending order. If you want to sort it in
SELECT *
FROM Employees
Order By ID;
Operations on DB
Records…
Insert
Insert into Table_Name values()
Delete
Delete from Customers where
age=31
Update
update Customers set
first_name="EMan" where
first_name="John"
Querry Writting
Create Database

Create Table
Querry Writting
Primary Key

Foreign key
Querry Writting
Alter Table
Alter table Table_Name
add GPA float

Drop Table
Drop table Table_Name
THANKS!!!

You might also like