Presentation on how to chat with PDF using ChatGPT code interpreter
Oracle fundamentals and sql
1. Introduction
Describing the Life Cycle Development Phases
Defining a Database
Discussing the Theoretical, Conceptual, and Physical Aspects of a Relational Database
Describing How a Relational Database Management System (RDBMS) Is Used to Manage
a Relational Database
Describing the Oracle Implementation of Both the RDBMS and the Object Relational
Database Management System (ORDBMS)
Describing How SQL Is Used in the Oracle Product Set
Writing a Basic SQL Statement
Describing the SQL Select Capabilities
Executing a Basic Select Statement with the Mandatory Clauses
Differentiating Between SQL and iSQL*Plus Commands
Restricting and Sorting Data
Limiting the Rows Retrieved by a Query
Sorting the Rows Retrieved by a Query
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 1
2. Suggested Study Material :
Oracle Database 10g SQL
By: Jason Price
› Publisher: McGraw-Hill/Osborne
› ISBN: 9780070587557
› Edition: 1 - Pub Date: 13-APR-04
› www.tatamcgrawhill.com/html/9780070587557.html
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 2
3. DBMS is the collection of interrelated data and a set of program to access the data.
DBMS allows only one person to access the data at a given point time.
While the DBMS fulfilled the basic requirements of storing data,they were not a
practical solution to efficiently storing,manipulating,and retrieving data quickly and
easily.
So based on the theory of relational data modeling by Dr. Edgar Codd publishes in the
year 1970 , In 1977 Software Development Laboratories (SDL) formed by Larry Ellison,
Bob Miner, Ed Oates and Bruce Scott with $2,000 of startup cash. Larry and Bob were
working on a CIA project code-named "Oracle."
In 1978 SDL changes its name to Relational Software Inc. (RSI) with CIA as the first
customer.
In 1982 RSI changes its name to Oracle Systems Corporation (OSC) and then simplifies
the name to Oracle Corporation.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 3
4. RDBMS manages large volumes of data while supporting a large number of users
simultaneously.
In a relational database,files do exist,but only as a medium to store data on disk.
While a file processing system will only access a particular file when necessary to
retrieve data,a relational database system will access all files simultaneously as
one seamless system. The data that is stored in the database is completely
independent of the files. The entire system is managed by a central database engine
that processes queries and manipulates data on demand. A single query can retrieve
the data regardless of where it is stored.
Instead of merely acting as a journal of transactions,a relational database preserves
the natural relationships that exist between real world entities and stores the data in
this manner.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 4
5. For example,data for a company’s employees is stored in a structure,with each
employee stored only once. Data for the employees’ dependents may also need to be
stored in another structure Each record for a dependent will contain a pointer which
references its related employee.
Figure in the next slide shows how the relational database preserves the relationships
that occur naturally between employees and their dependents.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 5
6. Dependen
t1
EMPLOYEE 1 Dependen
t2
Dependen
t1
Dependen
EMPLOYEE 2 t2
Dependen
t3
EMPLOYEE 3
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 6
7. As shown in the Figure, more dependents can be added to a single employee
without storing the employee’s information over and over again. Data can also be
stored for an employee that has no dependents whatsoever. If an employee
leaves
the company,deleting the employee would also automatically delete all data for
the employee’s dependents. Since data is stored only once,if an employee moves
to a new address,updating the data is only a matter of changing a single record.
This configuration reduces data redundancy,which saves critical storage space,
and still provides simplicity and ease in data management.
An additional benefit of the RDBMS is that it is self-describing. The database
contains not only users’ data,but also a description of its own structure, which is
commonly referred as metadata.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 7
8. Entity-Relationship Model
Entities
An entity is the person,place,thing,or abstract concept that you want to track in
the database. When building the data model,the first thing to do is identify all
the required entities based on the initial system requirements that were
determined during the analysis phase. Each entity must be clearly defined to
avoid ambiguity and design flaws.
You should first build a simple list of the entities, and then add each one to the
data model. In the James Martin data model,entities are represented by squares
with rounded corners and are labeled with their names.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 8
9. Below Figure shows a data model with a few example of entities for a
student registration system for a college.
STUDENT CLASS SUBJECT INSTRUCTOR
Since each entity in a data model should only represent a single instance of the
entity,the name of each entity should be listed in its singular form. The design
should only show how one single entity relates to another single entity.
The entities can be placed anywhere in the data model and can be adjusted for
clarity as more entities and relationships are added. Once the set of entities
has been identified and added to the model,you should review the model to
make sure that the model will conform to the system requirements. Later,once
the data model is complete,these entities will become tables that you will
create in the database.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 9
10. Attributes
Once the entities have been identified and added to the data model,you can
decide on the exact details for each entity that should be stored. At a minimum,
these details should fully support the initial system requirements,but you can also
include any additional details that you feel would contribute to the overall quality
of the system. Perhaps you see the opportunity to provide additional functionality
that might prove useful later on,such as a timestamp to store the most recent
time each customer signed onto the system.
First,you should build a list of attributes per entity using words that are simple,
but fully explain the exact purpose of the attribute. The attributes you decide on
will become the columns of the tables. If the columns are named properly early
in the design process,later users will not have to guess what a column is for.
Once clear attribute names have been identified,some people choose to convert
these names into appropriate column names.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 10
11. Following Figure shows the college student registration system with attributes.
STUDENT
CLASS
STUD_ID
CLASS_ID
L_NAME SUBJECT
SEMESTER
F_NAME
CLASS_NAME
ADDR_LINE SUBJECT_ID
SUBJECT
CITY SUBJECT_NAME
LOCATION
PIN DEGREE_PROG
DURATION
STATE
GRADE_LEVEL
PHONE_NO
INSTRUCTOR
INTRUC_ID
L_NAME
FNAME
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 11
12. Entities and Their Relationships
The relationships between entities is the focal point for the relational database
management system. Therefore,it is critical to understand how entity relationships
are defined and how these relationships are treated to preserve data integrity.
In a data model,to represent a relationship,you would simply draw a line connecting
two entities.
This indicates that in some way, shape or form, one or both entities influences the
other. However,this notation is simply not enough to provide a clear picture of the
implications of the relationship. You must also include the entities’ cardinality.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 12
13. Cardinality
Cardinality refers to the quantity of entity instances that are allowed on either
side of the relationship and is represented by making certain notations directly on
the relationship lines between the entities.
Types of Relationships
There are three main types of relationships,depending on the cardinality of the
entities involved. These are:
• One-to-one (1:1)—Indicates that one instance of an entity must be associated
with exactly one instance of another entity.
• One-to-many (1:M)—Indicates that one instance of an entity may be associated
with one or more instances of another entity.
• Many-to-many (M:N)—Indicates that one or more instances of an entity may
be associated with one or more instances of another entity.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 13
14. Cardinality Notations
CUSTOMER ORDER ITEM
The relationship between CUSTOMER and ORDER in Figure is a one-to- many
relationship; a single customer may have one or more orders. The relationship
between ORDER and ITEM is a many-to-many relationship; a single order may
contain multiple items,and a single item may be found on multiple orders. One-
to-one relationships are very rare, because such a relationship is simple one. If a
one-to-one relationship is found in a data model, the two entities can usually be
combined into a single entity without losing the meaningful value of the data.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 14
15. Normalization
The theoretical concepts of Mathematical Set Theory and Relational Algebra
allowed a database designer to organize data in a systematic fashion by
simply defining how each piece of data related to another through a process
called data normalization.
The purpose of normalization is to build a data model according to system
requirements and to make adjustments to the model to remove as many
design flaws as possible. The ultimate data model would provide
manageability so that a single piece of data can be updated in a single
location,and it would clearly show the relationships without ambiguity. All
design flaws and anomalies would be worked out of the design to allow the
most flexible database system without a single incident of redundancy. As
you can imagine, eliminating all anomalies is somewhat of a lofty goal and
is not often reached. As your data model moves closer to this goal,many
design anomalies and data management problems disappear.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 15
16. Strategy Software development Life cycle
and
Analysis
Design
Build and
Document
Transition Production
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 16
17. Oracle10g offers a comprehensive high performance infrastructure needed to
develop, deploy, and manage Internet applications or e-business solutions as follows
• GRID COMPUTING, AUTOMATION, SELF-MANAGEMENT
• Scalability from departments to enterprise e-business sites
Robust, reliable, available, secure architecture
One development model, easy deployment options
Leverage an organization’s current skill set throughout the Oracle platform
(including SQL,PL/SQL, Java, and XML)
One management interface for all applications
Industry standard technologies, no proprietary lock-in
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 17
18. Structured Query Language (SQL)
The SQL in PL/SQL stands for structured query language. We use SQL to SELECT,
INSERT, UPDATE, or DELETE data. We use it to create and maintain objects and
users, and to control access rights to our instances.
SQL (pronounced as sequel or by its letter abbreviation) is the entrance, or
window, to the database. It is a fourth-generation language (4GL) that is intended
to be easy to use and quick to learn. The basic SQL syntax is not the creation of
Oracle. It actually grew out of the work done by Dr. E.F. Codd and IBM in the
early 1970s. The American National Standards Institute (ANSI) recognizes SQL
and publishes standards for the language.
Oracle supports ANSI-standard SQL but also adds its own twist in its SQL*Plus
utility. Through SQL*Plus, Oracle supports additional commands and capabilities
that are not part of the standard. SQL*Plus is a utility available in multiple forms:
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 18
19. SQL*Plus in Oracle accepts literally dozens of commands and
has even more environmental settings. Many of the commands
accept arguments that control the effects of the command.
Some of the more commonly used commands are listed below.
CLEAR HOST
COLUMN LIST
CONNECT RUN
DEL SAVE
DESCRIBE SET
DISCONNECT SHOW
EDIT SHUTDOWN
EXECUTE SPOOL
EXIT START/STARTUP
GET SHOW ALL
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 19
20. Data Types Description
VARCHAR2 (SIZE) Variable-length character data
CHAR (Size) Fixed-length character data
NUMBER (p,s) Variable-length numeric data
DATE Date and Time Values
LONG Variable-length character data
Up to 2 gigabytes
CLOB Character data up to 4 gigabytes
RAW and LONG RAW Raw Binary Data
BLOB Binary Data up to 4 gigabytes
BFILE Binary Data stored in an external file
Up to 4 gigabytes
ROWID A 64 base number system representing
the unique address of a row in its table
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 20
21. Database Objects Description
Table Basic Unit of Storage, Composed of Rows and Columns
View Logically represents subset of date from one or more
tables
Sequence Numeric Value Generator
Index Improves the performance of some queries
Synonym Give alternative names of objects
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 21
22. Types of SQL Statements and their Representations
Select Data Retrieval
Insert
Update Data Manipulation Language (DML)
Delete
Merge
Create
Alter
Drop Data Definition Language (DDL)
Rename
Truncate
Commit
Rollback Transaction Control
Savepoint
Grant
Revoke Data Control Language (DCL)
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 22
23. The Basic Command
SELECT column_list
FROM table_name;
Filtering the Result Set
SELECT column_list
FROM table_name
WHERE conditions;
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 23
24. Using Arithmetic Operators with SQL Statements
Operator Description
+ Add
- Subtract
* Multiply
/ Divide
Example :
Select last_name, salary, salary + 300
From employees;
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 24
25. Oracle’s comparison operators are broken down into the following groups:
Simple comparison operators
Range comparison operators
Existence comparison operator
Similarity comparison operator
Null comparison operator
Regardless of the type of comparison operator that is used, the values that are
being compared must be of the same data type or an error will be returned. For
example,you cannot directly compare a NUMBER datatype to a DATE datatype.
Simple comparison operators test the condition of one value compared to another.
The Next Slide lists the comparison operators that are supported by Oracle.
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 25
26. Simple Comparison Operators
A=B
A != B, A <> B, A ^= B
A>B
A<B
A >= B
A <= B
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 26
27. Range Comparison Operators
IN
ANY, SOME
ALL
BETWEEN a AND b
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 27
28. Existence Comparison Operators
Operator Meaning
BETWEEN … AND …. Between Two Values
(Inclusive)
IN (SET) Match any of a list of Values
LIKE Match a Character Pattern
IS NULL Is a null Value
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 28
29. Similarity Comparison Operators
Operator Meaning
AND Return TRUE if both components
Conditions are true
OR Return TRUE if either components
Condition is true
NOT Return TRUE if the following
Condition is false
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 29
30. Obtaining Data from Multiple table using Join
Conditions and the Filter Clause
You can write the join condition in the where clause, by prefixing
the column name with the table name when the same column
name appears in more than one table
Syntax is :
SELECT table1.column, table2.column
From table1, table2
Where table1.column1 = table2.column2;
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 30
31. We are into training business since 10+ years and have trained
more than 1000+ candidates in the field of Database, Some of them
have given their valued opinion which can be looked into
http://www.plentynum.com/testimonials_academy.html
If you like us to contact you then fill up the form at
http://plentynum.com/enquiry.html
In case of any clarification / requirements you can mail the
undersigned or call us at +91.99713 65346 (Delhi) / +91.99032
69302 (Kolkata).
Disclaimer : Oracle and other product are registered trademark of their respective owners, this slide only is for help to an individual and we are nowhere
responsible for any error/fault coming from the said materials/slides
Database Basic & Advance Courses by Dip Mail me at
dip.ray@plentynum.com 31