Queries With Multiple Tables Updated
Queries With Multiple Tables Updated
Queries With Multiple Tables Updated
MULTIPLE
TABLES
BY
MANIKANDAN. R
o
o
o
o
o
DEFINITION
STUDENT
NAME
MARK1
MARK3
MARK3
TOTAL
AVG
RESULT
RAM
68
90
72
230
76.66
PASS
PARTHI
95
92
80
267
89.00
PASS
PAPPU
45
60
71
176
58.66
PASS
STUDENTINFO
NAME
ADDRESS
P_NUM
DOB
RAM
CHENNAI
223344
12-6-1997
PARTHI
HOSUR
228899
14-1-1996
PAPPU
VELLORE
228855
12-1-1993
AVG
RESULT
P_NUM
RAM
76.66
PASS
223344
PARTHI
89.00
PASS
228899
PAPPU
58.66
PASS
228855
SUB QUERIES
Some times we might need to write one SELECT
statement inside another that is called a nested query.
MARK1
MARK3
MARK3
TOTAL
AVG
RESULT
RAM
68
90
72
230
76.66
PASS
PARTHI
95
92
80
267
89.00
PASS
PAPPU
45
60
71
176
58.66
PASS
RESULT
NAME
MARK1
MARK3
MARK3
TOTAL
AVG
RESULT
RAM
68
90
72
230
76.66
PASS
PARTHI
95
92
80
267
89.00
PASS
JOINS
Join is a query in which data is retrieved from more than one
table.
Inner join:
Retrieving the data form two tables.
We need to identify the common column b/w two tables.
SELECT EMPID, ENAME, DEPT,MANAGER
FROM EMP,DEPT
WHERE EMP.DNO=DEPT.DNO;
The result of left outer join for the table A and B always
contain all records of the left table A.
NATURAL JOIN
UNION
Union operation combines two sets of rows.
Union by retrieving the information from the two SELECT
statements.