Structured Query Language (SQL) : It9 - Adbms
Structured Query Language (SQL) : It9 - Adbms
Language (SQL)
IT9 - ADBMS
SQL
Data Definition Language (DDL)
◦ Data structure – Database, Tables, Fields
CREATE
ALTER
DROP
Data Manipulation Language (DML)
◦ Record Management
INSERT INTO
UPDATE
DELETE
SELECT
HOW TO
SELECT
RECORDS
FROM TWO
OR MORE
TABLES?
JOIN
◦ is used to combine
rows from two or
more tables, based
on a related column
between them
◦ purpose is to bind
data together,
across tables
TYPES OF SQL JOIN
INNER JOIN
LEFT (OUTER) JOIN
RIGHT (OUTER) JOIN
FULL (OUTER) JOIN
TYPES OF SQL JOIN
INNER JOIN SELECT column_name
◦ Return records that FROM table1
have matching INNER JOIN table2
values on
both tables ON table1.column_name
= table2.column_name;
TYPES OF SQL JOIN
LEFT (OUTER) JOIN SELECT column_name
◦ Return all records FROM table1
from the left table, LEFT JOIN table2
and the matched
records from the ON table1.column_name
right table = table2.column_name;
TYPES OF SQL JOIN
RIGHT (OUTER) JOIN SELECT column_name
◦ Return all records FROM table1
from the right table, RIGHT JOIN table2
and the matched
records from the ON table1.column_name
left table = table2.column_name;
TYPES OF SQL JOIN
FULL (OUTER) JOIN SELECT column_name
◦ Return all records FROM table1
when there is a FULL OUTER JOIN table2
match
in either left or right ON table1.column_name
table = table2.column_name;