DBMS UNIT 3 SQL
SET OPERATIONS
Prepared By:
Ms. Barkha Namdev
What is SQL?
SQL stands for Structured Query Language.
SQL lets you access and manipulate databases.
SQL is Structured Query Language, which is a computer
language for storing, manipulating and retrieving data
stored in a relational database.
SQL is the standard language for Relational Database
System. All the Relational Database Management Systems
(RDMS) like MySQL, MS Access, Oracle, Sybase,
Informix, Postgres and SQL Server use SQL as their
standard database language.
What Can SQL do?
SQL can execute queries against a database
SQL can retrieve data from a database
SQL can insert records in a database
SQL can update records in a database
SQL can delete records from a database
SQL can create new databases
SQL can create new tables in a database
SQL can create stored procedures in a database
SQL can create views in a database
SQL can set permissions on tables, procedures, and
views
SET Operations in SQL
SQL supports few Set operations which can be
performed on the table data. These are used to get
meaningful results from data stored in the table, under
different special conditions.
In this tutorial, we will cover 4 different types of SET
operations, along with example:
UNION
UNION ALL
INTERSECT
MINUS
SET Operations in SQL
UNION is used to combine the results of two or
more SELECT statements. However it will
eliminate duplicate rows from its resultset. In case
of union, number of columns and datatype must
be same in both the tables, on which UNION
operation is being applied.
->
->UNION EXAMPLE
UNION ALL
This operation is similar to Union. But it also shows the
duplicate row.
UNION ALL
INTERSECT
->
OUTPUT
MINUS
EXAMPLE
OUTPUT