28 09
28 09
---------------------
is a procedural query language. Its main purpose is:
* take relations as input and results other relations as output.
-----------------------------------------------------------------------------------
-------
GENERAL statement:
P [col_names] S [condition] (table_name)
-----------------------------------------------------------------------------------
-------
* After discussion on 'select' and 'projection' we came to know that, both symbols
are to replaces some keywords in query.
-----------------------------------------------------------------------------------
-------
* The UNION operation operforms union between specified tables and specified
relations.
* To specify the union, use syntax:
(T1 U T2)
-----------------------------------------------------------------------------------
--------
Table 1 : book_authors
author_name book_title
---------------------------
Ramesh Let Us C
Jayesh Let Us C++
Varad Python
Nupur Java Programming
Prashant Adv. Python
Table 2 : article_writers
article_writer article_title
----------------------------------------
Varad New trends in Programming
Nupur Programming era
Prashant Adv. Python
Jayesh Tricks and logics in programming
Ramesh Evolving programming skills
Prashant Adv. Python
QUERY SYNTAX:
-------
FOR example:
---------------
select aurthor_name, book_title from book_authors
UNION
select article_title from article_writers
OUTPUT Table
-------------
author_name book_title article_title
------------------------------------------------
Ramesh Let Us C Evolving programming skills
Jayesh Let Us C++ Tricks and logics in programming
Varad Python New trends in Programming
Nupur Java Programming Programming era
Prashant Adv.Python Adv.Python
-----------------------------------------------------------------------------------
---------
OR
ACTUAL QUERY:
--------------
select aurthor_name, book_title from book_authors
UNION
select article_title from article_writers
-----------------------------------------------------------------------------------
------------
Example 2
----------
ACTUAL QUERY:
--------------
select aurthor_name, book_title from book_authors where author_name='Nupur'
UNION
select article_title from article_writers where article_writer='Nupur'
-----------------------------------------------------------------------------------
--------------
-----------------------------------------------------------------------------------
-------------