second to know database oracle step by step wisam
second to know database oracle step by step wisam
Data: Known facts that can be recorded and have an implicit meaning.
Database management system (DBMS): Collection of programs can create and maintain a database.
Application program: accesses the database by sending queries or requests for data to the DBMS.
Main Characteristics of the Database Approach:
1. Self-describing nature of a database system. 2. Insulation between programs and data.
3. Data Abstraction. 4. Support of multiple views of the data.
5. Sharing of data and multi-user transaction processing.
Actors on the Scene:
• Database administrators (DBA). • Database designers.
• End users. • System analysis and application programmers.
Workers behind the scene:
• DBMS system designers and implementers. • Tool developers.
• Operators and maintenance personnel.
Advantages of Using the Database Approach:
▪ Interacting easily with data using high-level dedicated tools.
▪ Controlling redundancy in data storage and in development and maintenance efforts.
▪ Sharing of data among multiple users.
▪ Ensuring consistency of data.
▪ Restricting unauthorized access to data.
▪ Providing storage structures for efficient query processing.
▪ Providing backup and recovery services.
▪ Providing multiple interfaces to different classes of users.
▪ Representing complex relationships among data.
▪ Enforcing integrity constraints on the database.
Data models: Collection of concepts that describe the structure of a database.
Data abstraction: It generally refers to the hiding of details of data organization and storage.
Categories of data models:
1. High level (conceptual data models): describe database of close way to user. Like (entity,
relationships) .
2. Low level (physical data models): provide concept that describe close of how data to be storage
.like (access path , index).
3. Representational data models (implementation): between user and storage. Like (network, object
data models).
4. Conceptual data models use concepts such as entities, attributes, and relationships.
Entity: represents a real-world object or concept, such as an employee or a project from the mini-
world.
Attribute: represents some property of interest that further describes an entity, such as the
employee's name or salary.
Relationship: among two or more entities represents an association among the entities.
Database Schema: The description of a database.
Schema diagram: A displayed scheme.
Schema construct: each object in the schema .
Databases state or snapshot: The data in database at particular moment in time .
Type of database state:
1. Empty state. 2. Curren state (current snapshot of database ).
Mahmoud Jamil
https://t.me/Mahmoud_1420h أو عن طريق التليجرام[email protected] :في حال وجود تعديل يرجى التواصل على اإليميل اآلتي
3. intension: The schema is Sometimes.
Schema evolution: that can be applied while the database operational.
The Three-Schema Architecture with diagram:
1. internal level internal schema: which describes the physical storage structure of the database.
2. conceptual level has a conceptual schema: which describes the structure of the whole database
for a community of users.
3. external or view level: includes a number of external schemas or use views.
Data Independence:
▪ Logical data independence: is the capacity to change the conceptual schema without having to
change external schemas or application programs.
▪ Physical data independence: is the capacity to change the internal schema without having to
change the conceptual schema.
Type of DBMS Languages:
• data definition language (DDL):can creat both schema.
• definition language (SDL):internal schema /phycal data model index ,access.
• view definition language (VDL): deal with external schemas.
• high-level or nonprocedural (DML):operation/insert ,update.
DBMS 1. Menu-Based web Browsing. 2. Forms-Based Interfaces.
Interfaces: 3. Graphical User Interfaces. 4. Natural Language Interfaces.
5. Speech Input and Output. 6. Interfaces for Parametric Users.
7. Interfaces for the DBA.
Database System Utilities : that help the DBA manage the database system.
Common utilities have the following types of functions:
1. Loading. 2. Backup.
3. Database storage reorganization. 4. Performance monitoring.
Tools, Application Environments, and Communications Facilities:
1. data dictionary (or data repository). 2. Application development environments.
3. communications software.
Database design process steps:
1. Requirements collection and analysis: Interview database users to understand and document their
data requirements & functional requirements (operations, transactions, retrievals and updates).
2. Conceptual design: Create a conceptual schema using a high-level conceptual data model (ER
Model).
3. Logical design or data model mapping: Mapping of database schema in the implementation data
model of the DBMS.
4. Physical design phase: In which the internal storage structures, file organizations, indexes, access
paths, and physical design parameters for the database files are specified.
Single-Valued Attributes: Most attributes have a single value for a particular entity.
Multivalued Attributes: have a set of values for the same entity.
Complex Attributes: Composite and Multivalued attributes can be nested arbitrarily.
Key Attributes: An important constraint on the entities of an entity type is the key or uniqueness
constraint on attributes.
Maximum Cardinality:
• One-to-One (1:1). • One-to-Many (1:N) or Many-to-One (N:1).
• Many-to-Many (N:M).
Minimum Cardinality:
Mahmoud Jamil
https://t.me/Mahmoud_1420h أو عن طريق التليجرام[email protected] :في حال وجود تعديل يرجى التواصل على اإليميل اآلتي
• zero. • one or more.
A tuple is an ordered set of values.
Constraints (or restrictions) on the actual values in a database state are derived from the rules in the
mini-world.
There are three main types of constraints:
1. Key constraints. 2. Entity integrity constraints. 3. Referential integrity constraints.
Super Key: A super key is a set of one or more columns (attributes) to uniquely identify rows in a
table.
Candidate key: A super key with no redundant attribute is known as candidate key. Candidate keys
are selected from the set of super keys.
Relational Database Schema: A set S of relation schemas that belong to the same database. S is the
name of the database. S={R1,R2,...,Rn}
Differences between Primary key and foreign key.
Key Primary Key Foreign Key
Basic It is used to uniquely identify data in the It is used to maintain relationship
table. between tables.
Null It can’t be null. It can accept the null values.
Duplicate Two or more rows can’t have same It can carry duplicate value for a foreign
primary key. key attribute.
Index Primary has clustered index. By default, It is not clustered index.
Tables Primary key constraint can be defined on It can’t be defined on temporary tables.
temporary table.
Relational Algebra: The basic set of operations for the relational model is the relational algebra.
These operations enable a user to specify basic retrieval requests as relational algebra expressions.
The SELECT Operation:
1. SELECT and PROJECT are unary operations because they operate on single relation.
2. The SELECT operation is used to choose a subset of the tuples from a relation that satisfies a
selection condition.
3. SELECT operation can also be visualized as a horizontal partition of the relation into two sets.
Syntax: Select < table_name> where <condition>
In SQL, the SELECT condition is typically specified in the WHERE clause of a query.
would correspond to the following SQL query:
SQL> SELECT * FROM EMPLOYEE WHERE Dno=4 AND Salary>25000;
In SQL, the PROJECT attribute list is specified in the SELECT clause of a query.
would correspond to the following SQL query:
SQL>SELECT DISTINCT Sex, Salary FROM EMPLOYEE;
UNION Operation: The result of this operation, denoted by R U S, is a relation that includes all
tuples that are either in R or in S or in both R and S. Duplicate tuples are eliminated.
INTERSECTION Operation: The result of this operation, denoted by R ∩ S, is a relation that
includes all tuples that are in both R and S.
SET DIFFERENCE (or MINUS) Operation: The result of this operation, denoted by R - S, is a
relation that includes all tuples that are in R but not in S.
CARTESIAN PRODUCT operation-also known as CROSS PRODUCT or CROSS JOIN - which is
denoted by x. This is also a binary set operation, but the relations on which it is applied do not have
to be union compatible.
Database design may be performed using two approaches:
(i) Bottom-up approach (ii) Top-down approach.
Mahmoud Jamil
https://t.me/Mahmoud_1420h أو عن طريق التليجرام[email protected] :في حال وجود تعديل يرجى التواصل على اإليميل اآلتي
A bottom-up design methodology (design by synthesis) considers the basic relationships among
individual attributes as the starting point and uses those to construct relation schemas.
This bottom-up approach is not very popular in practice:
i. Because it suffers from the problem of having to collect al arge number of binary relationships
among attributes as the starting point.
ii. For practical situations, it is next to impossible to capture binary relationships among all such
pairs of attributes.
a top-down design methodology (design by analysis) starts with a number of groupings of attributes
into relations that exist together naturally, for example, on an invoice, a form, or a report.
The relations are then analyzed individually and collectively, leading to further decomposition until
all desirable properties are met.
Informal Design Guidelines for Relation Schemas: Informal guidelines that may be used as
measures to determine the quality of relation schema design and may eventually answer.
Why Normalization for Relational Databases?
1. Making sure that the semantics of the attributes is clear in the schema.
2. Reducing the redundant information in tuples.
3. Reducing the NULL values in tuples.
4. Disallowing the possibility of generating spurious tuples.
Explanation of the normalization of relational databases:
GUIDELINE1: Design a relation schema so that it is easy to explain its meaning. Do not combine
attributes from multiple entity types and relationship types into a single relation.
GUIDELINE 2: Design a schema that does not suffer from the insertion, deletion and update
anomalies. If there are any present, then note them so that programs that update the database will
operate correctly. GUIDELINE 3: Relations should be designed such that their tuples will have as
few NULL values as possible. GUIDELINE 4: The relations should be designed to satisfy the
lossless join condition. No spurious tuples should be generated by doing a natural-join of any
relations.
Functional dependencies: are constraints that are derived from the meaning and interrelationships
of the data attributes. are used to specify formal measures of the "goodness" of relational designs.
Normalization: The process of decomposing unsatisfactory "bad" relations by breaking up their
attributes into smaller relations.
Normal Form: Condition using keys and FDs of are lation to certify whether a relation schema is in
a particular normal form.
Denormalization: The process of storing the join of higher normal form relations as a base relation-
which is in a lower normal form.
Benefit: Can improve performance (speed) by reducing numbers of tables lookup.
Why do we need Normalization?
• To reduce or minimize redundancy (Duplication of data) from the database.
• To save storage space and to make more efficient and error free database.
1. First Normal Form: Composite attributes: can be further subdivided.
• Multivalued attributes: can have set of value for same entity.
• Nested relations: part of the definition of relation, means No two columns can have the same name.
2. Second Normal Form:
• A relation schema R is in Second Normal Form (2NF), if every Non-prime attribute is Fully
functionally dependent on the Primary key.
• Prime attribute:- Attribute that is member of the primary key K.
Mahmoud Jamil
https://t.me/Mahmoud_1420h أو عن طريق التليجرام[email protected] :في حال وجود تعديل يرجى التواصل على اإليميل اآلتي
• Full functional dependency:- a FD Y-> Z where removal of any attribute from Y means the FD
does not hold any more.
3. Third Normal Form:
• Transitive functional dependency- a FD X->Z that can be derived from two FDs X->Y and Y->Z
Mahmoud Jamil
https://t.me/Mahmoud_1420h أو عن طريق التليجرام[email protected] :في حال وجود تعديل يرجى التواصل على اإليميل اآلتي