Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Database v1
1. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
0
2. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
1
1) What is a database?
A database is collection of information with relations organized to storing, managing and
efficient retrieval.
Databases allow their users to enter access, and analyze their data quickly and easily.
Databases allow their users to insert new record, update old one, delete not required record
and enable users to make queries.
2) Candidate Key
A candidate is a subset of a super key.
A candidate key is a single field or the least combination of fields that uniquely identifies
each record in the table.
The least combination of fields distinguishes a candidate key from a super key.
Every table must have at least one candidate key but at the same time can have several.
3) A primary key
A primary key is a candidate key that. is most appropriate to be the main reference key for
the table.
As its name suggests, it is the primary key of reference for the table and is used throughout
the database to help establish relationships with other tables.
As with any candidate key the primary key must contain unique values, must never be null
and uniquely identify each record in the table.
4) Foreign key
A foreign key is generally a primary key from one table that appears as a field in another
where the first table has a relationship to the second.
In other words, if we had a table A with a primary key X that linked to a table B where X
was a field in B, then X would be a foreign key in B.
3. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
2
5) Database Management System (DBMS)
A collection of programs that enables, you to store, modify, and extract information from a
database.
There are many different types of DBMSs, ranging from small systems that run on
personal computers to huge systems that run on mainframes.
6) Database Models
A database model is a type of data model that determines the logical structure of a database
and fundamentally determines in which manner data can be stored, organized, and
manipulated.
The most popular example of a database model is the relational model, which uses a table-
based format.
Data models can be relay on three models:
1-Logical data models for databases include:
• Hierarchical database model
• Network model
• Relational model
2- Physical data models include:
• Flat file
3- Other models include:
• Multidimensional model
• XML database
4. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
3
7) Data redundancy
Data redundancy in database means that some data fields are repeated in the database.
Disadvantages of data redundancy
• Increases the size of the database unnecessarily.
• Causes data inconsistency.
• Decreases efficiency of database.
• May cause data corruption.
8) Data consistency
Means that each user sees a consistent view of the data, including visible changes made by
the user's own transactions and transactions of other users.
By controlling the data redundancy, the data consistency is obtained. If a data item appears
only once, any update to its value has to be performed only once and the updated value
(new value of item) is immediately available to all users.
If the DBMS has reduced redundancy to a minimum level, the database system enforces
consistency. It means that when a data item appears more than once in the database and is
updated, the DBMS automatically updates each occurrence of a data item in the database.
9) Data Sharing
In DBMS, data can be shared by authorized users of the organization. The DBA manages
the data and gives rights to users to access the data.
Many users can be authorized to access the same set of information simultaneously. The
remote users can also share same data, similarly, the data of same database can be shared
between different application programs.
10) Data Concurrency
In a computer file-based system, if two users are allowed to access data simultaneously, it
is possible that they will interfere with each other.
5. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
4
11) Data Integration
In DBMS, data in database is stored in tables. A single database contains multiple tables
and relationships can be created between tables (or associated data entities).
This makes easy to retrieve and update data.
12) Integrity Constraints
Integrity constraints or consistency rules can be applied to database so that the correct data
can be entered into database.
The constraints may be applied to data item within a single record or they may be applied
to relationships between records.
13) Data Security
Data security is the protection .of the database from unauthorized users. Only the
authorized persons are allowed to access the database.
Some of the users may be allowed to access only a part of database i.e., the data that is
related to them or related to their department. Mostly, the DBA or head of a department
can access all the data in the database.
Some users may be permitted only to retrieve data, whereas others are allowed to retrieve
as well as to update data. The database access is controlled by the DBA
14) Data Atomicity:
A transaction in commercial databases is referred to as atomic unit of work.
15) Data Independence:
The separation of data structure of database from the application program that is used to
access data from database is called data independence.
In DBMS, database and application programs are separated from each other.
The DBMS sits in between them.
You can easily change the structure of database without modifying the application program.
6. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
5
16) Three Level Database Architectures
EXTERNAL LEVEL (user or view level)
• The user's view of the database.
• Consists of a number of different external views of the DB.
• Describes part of the DB for particular group of users.
• Provides a powerful and flexible security mechanism by hiding parts of the DB from
certain users. The user is not aware of the existence of any attributes that are missing
from the view.
• It permits users to access data in a way that is customized to their needs, so that the
same data can be seen by different users in different ways, at the same time.
CONCEPTUAL LEVEL (logical level)
The logical structure of the entire database as seen by DBA.
What data is stored in the database.
The relationships among the data.
INTERNAL LEVEL (physical level)
Physical representation of the DB on the computer.
How the data is stored in the database.
Physical implementation of the DB to achieve optimal run—time performance and
storage space utilization.
Storage space allocation for data and indexes –
Record description for storage
Record placement
Data compression, encryption
7. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
6
17) Database Users
Database administrators DBA
Is responsible for authorizing access to the database, for coordinating and monitoring
its use, and acquiring software and hardware resources as needed.
Database designers
Identify data to be stored in the database and choosing appropriate structures to
represent and store the data
End Users
Casual End Users Occasionally access may need different information each time. Use
query language to specify requests.
Naïve or parametric end users Main job is to query and update the database using
standard queries and updates
Sophisticated end users Engineers, scientists, analysts who implement applications to
meet their requirements.
Stand alone users Maintain personal databases using readymade packages.
System Analysts and Programmers
Determine the end user requirements (especially naïve and parametric end users) and
develop specifications for canned transactions that meet the requirements.
18) Types of database relationships
There are several types of database relationships
One to One Relationships
One to Many Relationships
Many to One Relationship
Many to Many Relationships
8. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
7
19) What are the difference between DDL, DML and DCL commands?
DDL
Data Definition Language (DDL) statements are used to define the database structure or
schema. Some examples:
CREATE - to create objects in the database
ALTER - alters the structure of the database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces allocated for the
records are removed
COMMENT - add comments to the data dictionary
RENAME - rename an object
DML
Data Manipulation Language (DML) statements are used for managing data within schema
objects. Some examples:
SELECT - retrieve data from the a database
INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - deletes all records from a table, the space for the records remain
MERGE - UPSERT operation (insert or update)
CALL - call a PL/SQL or Java subprogram
EXPLAIN PLAN - explain access path to data
LOCK TABLE - control concurrency
9. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
8
DCL
Data Control Language (DCL) statements. Some examples:
GRANT - gives user's access privileges to database
REVOKE - withdraw access privileges given with the GRANT command
TCL
Transaction Control (TCL) statements are used to manage the changes made by DML
statements. It allows statements to be grouped together into logical transactions.
COMMIT - save work done
SAVEPOINT - identify a point in a transaction to which you can later roll back
ROLLBACK - restore database to original since the last COMMIT
SET TRANSACTION - Change transaction options like isolation level and what
rollback segment to use
20) SQL & (PL/SQL)
SQL
SQL is a data oriented language for selecting and manipulating sets of data. PL/SQL is a
procedural language to create applications
(PL/SQL)
Procedural language/structured query language (PL/SQL) is Oracle’s implementation of
a structured query language (SQL) programming language extension.
PL/SQL is a powerful tool that combines SQL’s querying ability with the added bonus
of programming features.
10. Ministry of Higher Education Graduate Studies
Suez Canal University First-year Diploma
Faculty of Computing and Informatics DATABASE
Department of Information Systems Dr / Ahmed Sobhy
Prepared By: Aya Nabil, Ahmed Osama & Muhammad Ebrahim
9
21) composite key & Partial Key
A composite key
In the context of relational databases, is a combination of two or more columns in a
table that can be used to uniquely identify each row in the table.
Uniqueness is only guaranteed when the columns are combined; when taken
individually the columns do not guarantee uniqueness.
Partial Key:
It is a set of attributes that can uniquely identify weak entities and that are related to
same owner entity. It is sometime called as Discriminator.
22) Backup and Recovery Management
Backup and recovery is brought to mind whenever there is potential outside threats to a
database.
For example if there is a power outage,
Recovery management is how long it takes to recover the database after the outage.
Backup management refers to the data safety and integrity; for example backing up all your
mp3 files on a disk.
Best Wishes