New Microsoft Office Power Point Presentation
New Microsoft Office Power Point Presentation
Language (SQL)
TechnoLedge Services
Alok Garg
Chapter 1
Introduction
Introduction
Objectives:-
database
Describe the Oracle implementation of the RDBMS and
ORDBMS
Oracle9i Features
Oracle9i offers a comprehensive high-performance
infrastructure for e-business. It is called Oracle9i and includes
everything needed to develop,deploy and manage internet
applications.
Benefits include:-
Scalability from departments to enterprise e-business sites.
Robust,reliable,available,secure architecture.
One development model,easy deployment options
Leverage an organization’s current skillset throughout the Oracle
Platform(including SQL,PL/SQL,Java and XML)
One Management Interface for all applications.
Industry standard technologies,no proprietary lock-in.
Oracl9i
It has two products that provide a complete and
simple infrastructure for Internet applications :-
Oracle9i Application Server
Oracle9i Database
Oracle9i Application Server
Oracle9i Application Server runs all your applications.
Oracle9i Database stores all your data.
Oracle9i Application Server is the only application
server to include services for all the different server
applications you may want to run such as :-
Portals or Web sites
Java Transactional applications
Business Intelligence applications
It also provides integration between users,
applications and data throughout your organization.
Oracle9i Database
The roles of the two products are very straightforward. Oracle9i
manages all your data. This is not just the object relational data that
you expect an enterprise database to manage. It can also be
unstructured data like:-
Spreadsheets
Word Documents
PowerPoint presentations
XML
Multimedia data types like MP3,graphics,videos and more
Data does not even have to be in database. 9i DB has services thru
which you can store metadata about info stored in file systems. You
can use database server to manage and serve information wherever
located.
Relational Database Concept
Dr. E.F. Codd proposed the relational model for
database systems in 1970.
It is the basis for the relational database management
system ( RDBMS).
The relational model consists of the following:-
Collections of objects or relations.
Set of operations to act on the relations.
Data integrity for accuracy and consistency.
Definition of a relational Database
A relational database is a collection of relations or
two-dimensional tables.
A relational database uses relations or two-
dimensional tables to store information.
For example – You might want to store information
about all the employees in your company. In a
relational database, you create several tables to store
different pieces of information about your employees
such as an employee table, a department table and a
salary table
Data Models
Models are a cornerstone of design. Engineers build a model of a car to work out any
details before putting it into production. In the same manner, system designers develop
models to explore ideas and improve the understanding of the database design.
Purpose of Models :-
Models help communicate the concept in people’s minds. They can be used to do the
following :-
Communicate
Categorize
Describe
Specify
Investigate
Evolve
Analyze
Imitate
The objective is to produce a model that fits a multitude of these uses, can be
understood by an end user, and contains sufficient detail for a developer to build a
database system.
Database Terminology
ER Modelling
Entities
Attributes
RelationShips
Unique Identifiers
Relating Multiple Tables
Guidelines for Primary Keys & Foreign Keys
Relational Database Terminology
Table
Row
Column
Primary Key / Foreign Key
Field
Relational Database Properties
It can be accessed and modified by executing SQL
statements.
Contains a collection of tables with no physical
pointers.
Uses a set of operators
Communicating with RDBMS using SQL
SQL has following advantages:-
Efficient
Easy to learn and Use
Functionally Complete [ You can define, retrieve and
manipulate data in the tables ]
SQL Statements
Data Retrieval
SELECT
Data Manipulation
INSERT
UPDATE
DELETE
MERGE
DATA DEFINITION LANGUAGE
CREATE
ALTER
DROP
RENAME
TRUNCATE
SQL Statemens
Transaction Control
COMMIT
ROLLBACK
SAVEPOINT
Data Control
GRANT
REVOKE
Chapter 2
Writing Basic
SQL SELECT Statements
Objectives
To provide ability to do the following:-
Operator Precedence:-
*
/
+
-
Operator Precedence
Using Parentheses
To avoid operator precedence rules, use parentheses
Defining a NULL Value
A NULL is a value that is unavailable, unassigned,
unknown or inapplicable.
A NULL is not same as zero or blank space.
Arithmetic expressions containing a null value
evaluate to NULL.
Defining a Column Alias
A column alias:
Renames a column heading
Is useful with Calculations.
Immediately follows the column name – there can also
be an optional AS keyword between column name and
alias.
Requires double quotation marks if it contains spaces or
special characters or is case sensitive.
Concatenation Operator
A concatenation operator :-
Concatenation columns or character strings to other
columns.
Is represented by two vertical bars
Creates a resultant column that is a character
expression.
Example :-
SELECT last_name||job_id AS “Employees”
FROM employees;
Literal Character Strings
A literal is a character, a number, or a date included in
the SELECT list.
Date and character literal values must be enclosed
within single quotation marks.
Each character string is output once for each row
returned.
Select last_name,job_id,department_id
FROM employees
WHERE last_name = ‘Whalen’;
Comparison Conditions
Operators
=
>
>=
<
<=
<>
Other Comparison Conditions
Operator
BETWEEN ….. AND ……
IN(Set)
LIKE
IS NULL
Using the BETWEEN Condition
Use the BETWEEN Condition to display rows based
on a range of values.
SELECT last_name,salary
FROM employees
WHERE salary BETWEEN 2500 and 3000;
Using the IN Condition
Use the IN membership condition to test the values in
a list.
SELECT employee_id,last_name,salary
FROM employees
WHERE manager_id IN(1001,1002,1003);
Using the LIKE Condition
Use the LIKE condition to perform wildcard searches
of valid search string values.
Search conditions can contain either literal characters
or numbers:
% Denotes zero or many characters
_ Denotes one characters
Example
SELECT first_name
FROM employees
WHERE first_name LIKE ‘S%’;
Using the LIKE Condition
You can combine pattern-matching characters:-
SELECT last_name
FROM employees
WHERE last_name LIKE ‘_o%’;
Example :-
SELECT emp_id,last_name,job_id,salary
FROM employees
WHERE salary>=10000
AND job_id LIKE ‘%MAN%’;
Rules of Precedence
Order Evaluated Operator
1 Arithmetic Operator
2 Concatenation Operator
3 Comparison Operator
4 IS NULL,LIKE,IN
5 BETWEEN
6 NOT logical condition
7 AND logical condition
8 OR logical condition
SELECT last_name,job_id,salary
FROM employees
WHERE (job_id = ‘SA_PREP’
OR job_id = ‘AD_PRES’)
AND salary > 15000;
ORDER BY Clause
Sorting in Descending Order
Sorting by Column Alias
Sorting by Multiple Columns
Summary