Shelly Doc.
-
Upload
gagandeep-singh -
Category
Documents
-
view
227 -
download
0
Transcript of Shelly Doc.
-
8/6/2019 Shelly Doc.
1/24
Oracle and SQL
PROJECT FILE
OF
ORACLE
Supervised by: - Submitted by:Prof. Akshay Kumar Sharma Jasdeep Kaur
[1]
-
8/6/2019 Shelly Doc.
2/24
Oracle and SQL
ACKNOWLEDGEMENT
This term paper has been written with the kindassistance, guidance and active support of my
department teachers who have helped me a lot in
completing this paper. I express my deep regards
particularly to my esteem guide and supervisor Prof.
Akshay Kumar Sharma for his valuable advice and support
to complete this work.
I appreciate the concern shown by Prof. Sharma. Who
guided me from time to time in giving final shape to this
paper.
Last but not least I am thankful to my parents and who
helped me lot in preparing this paper.
[2]
-
8/6/2019 Shelly Doc.
3/24
Oracle and SQL
INDEX
S.NO.
1.
PERTICULARS PAGE NO. REMAKS
[3]
-
8/6/2019 Shelly Doc.
4/24
Oracle and SQL
[4]
-
8/6/2019 Shelly Doc.
5/24
Oracle and SQL
[5]
ORACLE
-
8/6/2019 Shelly Doc.
6/24
Oracle and SQL
INTRODUCTION OF ORACLE
Oracle is currently one of the most widely used RDBMS that provides efficient solutions for the
database applications. It is responsible for accurately storing the data and efficiently retrieving
that data in response to a user query. The Oracle Database is an object-relational databasemanagement system produced and marketed by Oracle Corporation. Most Oracle databaseinstallations traditionally came with a default schema called SCOTT. After the installation
process has set up the sample tables, the user can log into the database with the username Scott
and the password tiger. The name of the SCOTT schema originated with Bruce Scott, one of the
first employees at Oracle (then Software Development Laboratories), who had a cat named
Tiger.
Oracle provides a wide range of softwares designed for todays business that moves at speed of
internet. Millions of application developers and database administrators around the world use
oracle to built complex system that manage huge amount of data. Oracle consists of multitude of
powerful features and components which makes it different from other rdbms. It include e-
commerce, human resources, strategic enterprise management, mobile computing,
manufacturing, high performance business intelligent services etc. oracle also provides open
access to web servers through SQL, java, standard web interfaces. Oracle is supported over
different operating environments ranging from IBM mainframes, UNIX based mini computers,
Windows NT, DEC, VAX minicomputers etc.The Oracle RDBMS stores data logically in theform oftable spaces and physically in the form of data files. Oracle Database software comes in
63 language-versions. Variations between versions cover the names of days and months,
abbreviations, time-symbols such as A.M. and A.D., and sorting.
Oracle Corporation has translated Oracle Database error-messages into Arabic, Catalan, Chinese,
Czech, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hungarian, Italian,
Japanese, Korean, Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Spanish,
Swedish, Thai and Turkish.
Oracle Corporation provides database developers with tools and mechanisms for producing
internationalized database applications: referred to internally as "Globalization".
[6]
http://en.wikipedia.org/wiki/Object-relational_database_management_systemhttp://en.wikipedia.org/wiki/Object-relational_database_management_systemhttp://en.wikipedia.org/wiki/Oracle_Corporationhttp://en.wikipedia.org/wiki/Data_storage_devicehttp://en.wikipedia.org/wiki/Tablespacehttp://en.wikipedia.org/wiki/Computer_filehttp://en.wikipedia.org/wiki/Object-relational_database_management_systemhttp://en.wikipedia.org/wiki/Object-relational_database_management_systemhttp://en.wikipedia.org/wiki/Oracle_Corporationhttp://en.wikipedia.org/wiki/Data_storage_devicehttp://en.wikipedia.org/wiki/Tablespacehttp://en.wikipedia.org/wiki/Computer_file -
8/6/2019 Shelly Doc.
7/24
Oracle and SQL
FULL FORM
The Oracle Database is commonly referred to as Oracle RDBMSor simply as Oracle.
A relational database management system (RDBMS) is a database management
system (DBMS) that is based on the relational model as introduced by E. F. Codd. Most popular
commercial and open source databases currently in use are based on the relational database
model.
A short definition of an RDBMS may be a DBMS in which data is stored in the form of tables
and the relationship among the data is also stored in the form of tables.
HOW IT WAS GENERATED
Larry Ellison and his friends and former co-workers Bob Minerand Ed Oates started the
consultancy Software Development Laboratories (SDL) in 1977. SDL developed the original
version of the Oracle software. The name Oracle comes from the code-name of a CIA-funded
project Ellison had worked on while previously employed by Ampex
HEAD
[7]
http://en.wikipedia.org/wiki/Database_management_systemhttp://en.wikipedia.org/wiki/Database_management_systemhttp://en.wikipedia.org/wiki/Relational_modelhttp://en.wikipedia.org/wiki/E._F._Coddhttp://en.wikipedia.org/wiki/Larry_Ellisonhttp://en.wikipedia.org/wiki/Bob_Minerhttp://en.wikipedia.org/wiki/Ed_Oateshttp://en.wikipedia.org/wiki/Central_Intelligence_Agencyhttp://en.wikipedia.org/wiki/Ampexhttp://en.wikipedia.org/wiki/Database_management_systemhttp://en.wikipedia.org/wiki/Database_management_systemhttp://en.wikipedia.org/wiki/Relational_modelhttp://en.wikipedia.org/wiki/E._F._Coddhttp://en.wikipedia.org/wiki/Larry_Ellisonhttp://en.wikipedia.org/wiki/Bob_Minerhttp://en.wikipedia.org/wiki/Ed_Oateshttp://en.wikipedia.org/wiki/Central_Intelligence_Agencyhttp://en.wikipedia.org/wiki/Ampex -
8/6/2019 Shelly Doc.
8/24
Oracle and SQL
HISTORY OF ORACLE
In June 1970, Dr. E.F. Codd published a paper entitled A Relationship Model of data for large
shared data banks. This relational model, sponsored by IBM, then came to accepted as the
definitive model for Relational Database Management System. The language developed by IBM
to manipulate the data stored with in Codds model as originally called Structured English Query
Language, but then word English later being dropped in favor of STRUCTURED QUERY
LANGUAGE.
SQL originated with the system R project in 1974 at IBMs San Jose Research Center. The
purpose of this project was to validate the feasibility of the rational model and to implement a
DBMS based on this model. In addition to contributing to the concept of query complication and
optimization and concurrency controlled mechanisms, the most salient result of this research
project was the development of SQL. A large number of commercial relational DBMS products
were released from IBM as a conclusion of system R project.
In late 1970s Lawrence Joseph Ellison and Robert n minor were working on consulting project
for the CIA in USA where CIA wanted to use SQL. The code name for the project was
ORACLE. Initially, the oracle corporation was named as Relational Software Inc. in 1977. But
later to avoid confusion with competitor RTI, the companys name RSI was changed to Oracle
Corporation.
Today Oracle is the gold standard for database technology and applications in enterprisesthroughout the worldthe company is the world's leading supplier of information management
software and the world's second largest independent software company. The acquisition of Sun
gives Oracle a leadership role in the hardware arena as well.Now more than ever before Oracletechnology can be found in nearly every industry, and in the data centers of 100 of the Fortune
Global 100 companies. Oracle is the first software company to develop and deploy 100 percent
internet-enabled enterprise software across its entire product line: database, businessapplications, application development, and decision support tools.Before the acquisition of Sun was final, Oracle and Sun introduced the Sun Oracle DatabaseMachine, the world's fastest machine for any type of database workload. Today, Sun Oracle Real
Application Clusters, Oracle Applications,Oracle Grid Computing,support for enterprise Linux,
and Oracle Fusion, all fuel a commitment to innovation and results that has defined Oracle forthirty years.
[8]
http://www.oracle.com/database/database-machine.htmlhttp://www.oracle.com/database/database-machine.htmlhttp://www.oracle.com/database/rac_home.htmlhttp://www.oracle.com/database/rac_home.htmlhttp://www.oracle.com/us/products/applications/index.htmhttp://www.oracle.com/us/technologies/grid/index.htmhttp://www.oracle.com/us/technologies/linux/index.htmhttp://www.oracle.com/us/products/applications/fusion/index.htmhttp://www.oracle.com/database/database-machine.htmlhttp://www.oracle.com/database/database-machine.htmlhttp://www.oracle.com/database/rac_home.htmlhttp://www.oracle.com/database/rac_home.htmlhttp://www.oracle.com/us/products/applications/index.htmhttp://www.oracle.com/us/technologies/grid/index.htmhttp://www.oracle.com/us/technologies/linux/index.htmhttp://www.oracle.com/us/products/applications/fusion/index.htm -
8/6/2019 Shelly Doc.
9/24
Oracle and SQL
FEATURES OF ORACLE
1)Client/server environment : Oracle allows processing to be split between the clientapplication programs and the database server, the bulk of database processing is done on the
backend i.e. database server that typically has more computing power and better access to
data to enhance the processing capabilities.
2)Scalability : Oracle supports a large numbers of concurrent users executing different typesof application operating on the same data. It helps to add or remove users without
interrupting the other users.
3)Handles large databases and performs space management : Oracle providessupport for handling large amount of data stored in database. It allows full control of space to
make efficient use of expensive hardware devices.
4)High performance : Oracle maintains high degree of overall system performance byimplementingdatabase task in parallel with speed up querying, tuning, maintenance ofdatabase.
5)Availability : Oracle provides high availability of data. Operations such as partial
computer system failures and database backup failuresdo not interrupt the availability ofdata to the users.
6)Security : Oracle provides safe-security features to protect database access againstunauthorized use from the intruders. It provides the security by:
Account disablement after a specified number of failed attempts.
Password expiration and forced password changes.
Password history maintenance to prevent users from reusing previous passwords.
Complex password enforcement that forces users to choose passwords which cannot be
easily guessed by potential intruders.
7)Database enforced integrity : oracle enforces data integrity by providing the integrityconstraints thus restricting users from entering the data which do not validate the rules of
integrity constraints.
[9]
-
8/6/2019 Shelly Doc.
10/24
Oracle and SQL
8)Openness industry standards : Oracle follows the industry accepted standards for thedata access language network communication protocols, operating systems.
ORACLE PRODUCTS
1) APPLICATION DEVELOPMENT TOOLS: Following tools are used for the
application development.
SQL* PLUS: A command line tool used to manipulate tables and other database
objects in a oracles database. In oracle 9i, it is named as ISQL *PLUS.
DEVELOPER/2000: It is a family of tools the supports the development client/server
applications. It includes forms, reports, and graphics.
Oracle forms: it is an enterprise tool used to develop data entry forms and menus thataccess tables in an oracles database.
Oracle reports: It is a report writer tool used to develop reports that access tables in a
oracle database.
Oracles graphics: A graphical tool used to develop charts and presentation graphics
from database queries.
DESIGNER/2000: It is a family of tools that support the development of complex
applications that may span many organizations with in an enterprise
PROGRAMMER/2000: it includes the PRO* precompliers i.e. libraries routines and
utilities that can be linked with C, C++, java, Fortran, Cobol or other host
languages to allow access to oracles database.
2) DATABASE UTILITIES
ENTERPRISE MANAGER: A GUI based collection of utilities for managing Oracle
database.
EXPORT/IMPORT: Command line utilities that allows a user or DBA to export data
from an ORACLE database into a machine readable file to an Oracle database.
[10]
-
8/6/2019 Shelly Doc.
11/24
Oracle and SQL
SQL* LOADER: A command line utility to load ASCII data files into an Oracle
database.
SQL* DBA and SVRMGR: A utility that allows a DBA to monitor database activity and
to tune the database for optimal performance.
3)MIDDLEWARE AND CONNECTIVITY PRODUCTS
SQL* NET: A communication driver that allows an Oracle tool running on an clientmachine to access data on a separate server machine.
ORACLE ODBC DRIVERS: Open database connectivity drivers for connecting
software such as visual basic to oracle.
[11]
-
8/6/2019 Shelly Doc.
12/24
Oracle and SQL
Structured
Query
Language
[12]
-
8/6/2019 Shelly Doc.
13/24
Oracle and SQL
STRUCTURED QUERY LANGUAGE
The SQL*Plus module of the ORACLE database management system is used to create, modify
and query databases and to produce simple reports from them. This document is designed to beused while logged on to a computer system which runs ORACLE or while using a PC with
ORACLE. It introduces SQL*Plus by giving examples of commands. Type the commands as
indicated to see their effects. Some of the examples are complex; they have been included to
illustrate the power of SQL. The examples are also available as files which can be used as
described later. There are two types of command in SQL*Plus - standard SQL commands and
commands specific to SQL*Plus.
SQL*Plus commands
SQL*Plus commands are used to control the way results are displayed, show the definition of a
table, edit commands etc. They are one line long only. They can optionally be terminated by a
semicolon.
SQL commands
SQL commands are used to create, query and maintain a database. A command may be
continued over several lines and is stored in a buffer until it is overwritten. SQL*Plus prompts
for the second and subsequent lines of the SQL command by displaying the current line number.
The default buffer can contain only a single SQL command. The command is executed when a
terminating semicolon is typed. It can be terminated without executing it by entering a blank
line. The SQL*Plus run command lists then runs the command in the default buffer; a / (slash)
executes the SQL command without listing it.
Using it its users can connect to database, either on a same machine or a database located on a
different server machine across a network. SQL*PLUS performs the following task along with
manipulation of SQL commands and PL/SQL blocks.
Administering the database
Formatting, calculations, printing query results in the form of reports
Copy data between databases.
Creating script files to store SQL statements for future use.
Listing tables and PL/SQL object in the database.
[13]
-
8/6/2019 Shelly Doc.
14/24
Oracle and SQL
HOW TO START
[14]
-
8/6/2019 Shelly Doc.
15/24
Oracle and SQL
LANGUAGES
Data Definition Language (DDL) Statements
Data definition language (DDL) statements let you to perform these tasks
Create, alter, and drop schema objects Grant and revoke privileges and roles
Analyze information on a table, index, or cluster
Establish auditing options Add comments to the data dictionary
[15]
-
8/6/2019 Shelly Doc.
16/24
Oracle and SQL
The CREATE; ALTER, and DROP commands require exclusive access to the specified
object. For example, an ALTER TABLE statement fails if another user has an open transaction
on the specified table.
Data Manipulation Language (DML) Statements
Data manipulation language (DML) statements access and manipulate data in existing schemaobjects. These statements do not implicitly commit the current transaction. The data
manipulation language statements are:
CALL, DELETE, EXPLAIN PLAN, INSERT LOCK, TABLE MERGE, SELECT
UPDATE. The SELECT statement is a limited form of DML statement in that it can onlyaccess data in the database. It cannot manipulate data in the database, although it can
operate on the accessed data before returning the results of the query.
The CALL and EXPLAIN PLAN statements are supported in PL/SQL only when executeddynamically. All other DML statements are fully supported in PL/SQL.
Transaction Control Statements
Transaction control statements manage changes made by DML statements. The transaction
control statements are: COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION. All
transaction control statements, except certain forms ofthe COMMIT and ROLLBACK commands, are supported in PL/SQL. For information on
the restrictions, see COMMIT and ROLLBACK.
Data Control Language
DCLis a computer language and a subset ofSQL, used to control access to data in a database.Examples of DCL commands include: GRANT,REVOKE, CONNECT,
SELECT,INSERT,UPDATE,DELETE,EXECUTE,USAGE. In Oracle, executing a DCL
command issues an implicit commit. In PostgreSQL, executing DCL is transactional, and can be
rolled back.
DDL STATEMENTS
1.CREATE :
In order to store and manage the data it is necessary to create tables. In Oracle, Tables arecreated using CREATE TABLE command which is one of the important DDL statement.
This command specifies the name of table, name of columns in table as well as the data
type and if required constraints associated with each column of table. To create the table
in your schema, you must have the CREATE TABLE system privilege. To create table inanother users schema. You must have CREATE ANY TABLE system privilege.
[16]
http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_4010.htm#i2060233http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_9021.htm#i2104635http://en.wikipedia.org/wiki/Computer_languagehttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/Grant_(SQL)http://en.wikipedia.org/w/index.php?title=Revoke_(SQL)&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Connect_(SQL)&action=edit&redlink=1http://en.wikipedia.org/wiki/Select_(SQL)http://en.wikipedia.org/wiki/Insert_(SQL)http://en.wikipedia.org/wiki/Update_(SQL)http://en.wikipedia.org/wiki/Delete_(SQL)http://en.wikipedia.org/w/index.php?title=Execute_(SQL)&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Usage_(SQL)&action=edit&redlink=1http://en.wikipedia.org/wiki/Oracle_databasehttp://en.wikipedia.org/wiki/PostgreSQLhttp://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_4010.htm#i2060233http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_9021.htm#i2104635http://en.wikipedia.org/wiki/Computer_languagehttp://en.wikipedia.org/wiki/SQLhttp://en.wikipedia.org/wiki/Grant_(SQL)http://en.wikipedia.org/w/index.php?title=Revoke_(SQL)&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Connect_(SQL)&action=edit&redlink=1http://en.wikipedia.org/wiki/Select_(SQL)http://en.wikipedia.org/wiki/Insert_(SQL)http://en.wikipedia.org/wiki/Update_(SQL)http://en.wikipedia.org/wiki/Delete_(SQL)http://en.wikipedia.org/w/index.php?title=Execute_(SQL)&action=edit&redlink=1http://en.wikipedia.org/w/index.php?title=Usage_(SQL)&action=edit&redlink=1http://en.wikipedia.org/wiki/Oracle_databasehttp://en.wikipedia.org/wiki/PostgreSQL -
8/6/2019 Shelly Doc.
17/24
Oracle and SQL
SYNTAX
CREATE TABLE [SCHEMA.]
([DEFAULT][]
[, [DEFAULT][]][,.]
[, [DEFAULT][]][, ]
);
2.ALTER :
You cannot only modify the columns that exist in your tables but you can also drop thementirely. You can also remove the constraints from the table using the ALTER TABLE
statement. When a constraint is dropped, any associated index with that constraint is alsodropped.
SYNTAX
ALTER TABLE DROP COLOMN (for dropping
one colomn)
ALTERTABLE
DROP (, ); (for dropping multiple tables)
3. DROP
Sometime it is necessary to remove table from database completely that is no longer
needed. It can be done by using DROP TABLE command. The DROP TABLE command
removes the table from the database. All the table rows, indexes and privileges will also
be removed. The CASCADE CONSTRAINT is the optional parameter which is used for
tables which have foreign keys that reference the table being dropped. If cascade
constraint is not specified and user attempts to drop a table that has records in child table,
then error will occur.
SYNTAX
[17]
-
8/6/2019 Shelly Doc.
18/24
Oracle and SQL
Drop Table[ CASCADE CONSTRAINTS];
4.RENAME
Oracle provides the facility to change the name of table by using ALTER TABLE
statement. When you rename the table, Oracle automatically updates foreign keys, in data
dictionary but it does not updates a store code module, stored queries or reports client
applications. So care must be taken when renaming the table.
STNTAX
ALTER TABLERENAMETO;
OR
RENAME to ;
DML STATEMENTS
i. INSERT
The INSERT statement is used to add new row to the table. To insert new row into the table,
table must be in your schema or you must have INSERT privilege on the table. Only one row is
inserted at a time with this syntax. You can insert literal values, expressions containing operators
and functions, null values etc. only. You can insert rows into table without specifying the column
name because they are optional.
[18]
-
8/6/2019 Shelly Doc.
19/24
Oracle and SQL
SYNTAX
INSERT INTO [([, ][,])]
VALUES
([, ][,]);
ii.DELETE
The DELETE statement is used to remove the row from table. You do not need to know
the physical ordering of the rows in a table to perform a DELETE. Oracle database
engine determines the internal location of rows. To delete rows from table, it must be in
your own schema or you must have delete privilege on the table. A condition is used in
the WHERE clause to filter the records that are actually being removed. Zero or more
rows can be removed from the table. If such expression will not be provided then
DELETE statement will remove all rows from table.
SYNTAX
DELETE FROM
[WHERECONDITION]
iii.UPDATE
As it is required to make changes or modifications in the records of table, so in order to
make these changes, the UPDATE statement is used. With this statement the user can
modify the existing data stored in table. It can update zero or more rows in table. Toupdate rows in table, it must be in your schema or you must have update privilege on
table.
Following points should be remembered while executing UPDATE statement.
It can only reference a single table.
At least one column must be assigned an expression in SET clause.
[19]
-
8/6/2019 Shelly Doc.
20/24
Oracle and SQL
On omitting, the update statement automatically updates all the records of the table
on execution.
Multiple conditions should be given in where clause.
iv.
ORACLE DATA TYPESOracle tables are used for storing data which consist of both rows and columns. The columns are
used for storing an attributes data. Each column in a table has a column name and a data type.
Following are the different data types:-
1 CHARCTER DATA TYPE
Character data types are used to declare columns containing character data in the
database. Following are the different character data type:
o CHAR (n): This data type is used for storing fixed length character strings.
Once a char column is defined, all values stored in that column will also
have the length as specified in the length of declaration.
[20]
-
8/6/2019 Shelly Doc.
21/24
Oracle and SQL
o VARCHAR (n): This data type is used to store variable length character
strings, but oracle recommends using VARCHAR2 (n) data type instead
of VARCHAR (n) data type.
o VARCHAR2 (n): This data type is used to store variable length character
string. When declaring a column of data type VARCHAR2, you must
specify its size.
o NCHAR (n): This data type is used to store fixed length national character
set. This character set enables developers and administrators to extend the
standard database character set, in order to store data in language and
characters set other than English.
o NVARCHAR2 (n): This data type is used to store variable-length string in
database national character set. When you create a table with it you define
the column length either in characters or in bytes.
o LONG (n): This data type is used to store a large amount of variable length
character strings. It is mostly used to store long text strings.o RAW and LONGRAW: They both are used to store binary data such as
sound, graphics, documents etc.
2 NUMBER DATA TYPES
The NUMBER data types are used for storing numeric data such as integers, floating
point numbers and real numbers. The NUMBER data types offer great flexibility for
storing numeric data.
o NUMBER: This data type is used to store zero, positive and negative fixed
and floating point numbers. The NUMBER data type have a precision and
a scale. The precision is the total number of digits in the number and can
range from 1 to 38digits. The scale describes the number of digits to right
of decimal point in any given number.
3 DATE/TIME DATA TYPE
It stores data and time information.
o DATE: this data type is used to store data and time information. It is storein specified internal oracle format that includes not only the month, day
and year but also the hours, minutes and seconds.
o TIME STAMP: it is an extension of the date data type. It allows time to be
stored as date with fractional seconds. Its syntax is
TIMESTAMP [(fract_second_precision)].
[21]
-
8/6/2019 Shelly Doc.
22/24
Oracle and SQL
o INTERVAL YEAR TO MONTH: it allows time to be stored as an interval
of years and month. Its syntax: INTERVALYEAR [(year_percision)]TO
MONTH.
o INTERVAL DAY TO SECOND: it allows time to be stored as an interval
of days to hours, minutes and seconds.
4 LOBS
The large objects provide a more flexible storage mechanism for large amount of binary
and character based data such as text, image video, sound etc.
o BLOB: The binary large object data type is used to store binary data such
as images, audio files, video etc.
o CLOB: The character large object data type is used for storing large
amount of character data. It is used in place of VARCHAR2 column to
store text in applications when the size of data is 4000 characters.
o BFILE: the binary file data type when declared for a column contains
pointers to large binary files stored on the file system of the data base
server.
OPERATORSAn operator manipulates individual data item and returns a result. The data items on which
operators act upon are called operands. Some operators require two operand while other act upononly one operand. The operators which act upon one operand are called unary operators and
operators that act upon two operand are called binary operators. The operators are represented by
special characters and keywords. For example: the addition operator is represented by plus sign
and operator that test for nulls is represented by IS NULL.
1) ARITHMATIC OPERATORS
[22]
-
8/6/2019 Shelly Doc.
23/24
Oracle and SQL
These operators are used in an expression to add, subtract, multiply, negative, divide
numeric values. Result of operation is also a numeric value.+ and operators are also
used in date arithmetic.
+: donates the positive expression when used as unary operators. E.g. + 5 add two
operands when used as binary operators.
-: donates a negative expression when used as unary expression
*: Multiplies two operands. E.g. 6*5 is a Binary operator.
/: Divides two operands. It is a binary operator e.g. 10/5
2) COMPARISON OPERATORS
These are used to compare one expression with other. The result for such comparison can
be TRUE, FALSE, or UNKNOWN.
>: if (expr 1> expr 2) then the greater than comparison operator results TRUE if expr 1 is
greater than expr 2, otherwise false= expr 2) then the greater than equal to comparison operator results TRUE
if expr 1 is greater than equal to expr 2, otherwise false.
-
8/6/2019 Shelly Doc.
24/24
Oracle and SQL
NOT: it is urinary operators which return TRUE, if the condition is FALSE. Returns
FALSE if either is FALSE otherwise return UNKNOWN.
4) CONCATENATION OPERATORS (ii)
The concatenation operator is used to concatenate two or more strings.
5) SET OPERATORS
These operators combine the result of two component queries into single result.
UNION: It returns all rows selected by either query excluding all duplicates.
UNIONALL: It returns all rows selected by either query including all duplicates.
INTERSECT: It returns all distinct rows selected by both queries.
MINUS: It returns all distinct rows selected by the first query but not the second.
6) Other in-built operators
Some other in built operators include(+) which used in outer join operators, PRIOR used
in tree structure queries.
[24]