0% found this document useful (0 votes)
39 views16 pages

SQL Set Operations Explained

This document provides an overview of SQL (Structured Query Language), which is used for accessing and manipulating relational databases. It outlines the capabilities of SQL, including executing queries, retrieving, inserting, updating, and deleting records, as well as creating databases and tables. The document also introduces set operations in SQL, specifically UNION, UNION ALL, INTERSECT, and MINUS, explaining their functions and requirements.

Uploaded by

sc21cs301097
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views16 pages

SQL Set Operations Explained

This document provides an overview of SQL (Structured Query Language), which is used for accessing and manipulating relational databases. It outlines the capabilities of SQL, including executing queries, retrieving, inserting, updating, and deleting records, as well as creating databases and tables. The document also introduces set operations in SQL, specifically UNION, UNION ALL, INTERSECT, and MINUS, explaining their functions and requirements.

Uploaded by

sc21cs301097
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

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

You might also like