SELECT
column_names [,... n]
FROM
Table_1 CROSS JOIN Table_2
SQL FULL OUTER JOIN operatori 1 jadvaldagi xar bir element uchun 2 jadvaldagi elementlarni bog`lab chiqadi.
SQL FULL OUTER JOIN operatorining sintaksisi quyidagi ko`rinishda bo`ladi:
|
SELECT
column_names [,... n]
FROM
Table_1 FULL JOIN Table_2
ON condition
|
12.4 – rasm. Full outer join operatorining Venn diagrammasi orqali ko’rinishi.
Ishni bajarish tartibi
Faculty, university, xodim nomli jadvalla ustida vazifa bajariladi:
SQL INNER JOIN operatori
So`rov:
SELECT f.id, f.name faculty, u.name university
FROM faculty f INNER JOIN university u
ON f.id_test1_foreign=u.id;
Natija:
2. LEFT JOIN operatori
So`rov: SELECT f.id, f.name faculty, u.name university
FROM faculty f LEFT JOIN university u
ON f.id_test1_foreign=u.id;
Natija:
RIGHT JOIN operatori
So`rov: SELECT f.id, f.name faculty, u.name university
FROM faculty f RIGHT JOIN university u
ON f.id_test1_foreign=u.id;
Natija:
3. CROSS JOIN operatori
So`rov: SELECT *
FROM faculty CROSS JOIN xodim
ON faculty.id=xodim.faculty_id;
Natija:
4. LEFT OUTER JOIN operatori:
So`rov: SELECT *
FROM faculty LEFT OUTER JOIN xodim
ON faculty.id=xodim.faculty_id;
Natija:
5. RIGHT OUTER JOIN operatori:
So`rov: SELECT *
FROM faculty RIGHT OUTER JOIN xodim
ON faculty.id=xodim.faculty_id;
Natija:
Vazifalar
Yuqorida ko`rsatilganlardan foydalanib tanlangan variyantga muvofiq mavzu uchun MySQL da INNER JOIN, LEFT JOIN, RIGHT JOIN, CROSS JOIN, FULL OUTER JOIN va ON standat so`zilari bilan ishlang.
Bajarilgan ishlar haqida hisobot tayyorlang (1-2-ilovalarga qarang).
Nazorat savollari
SQL tilidagi qanday JOIN larni bilasiz?
INNER JOIN qanday vazifani bajaradi?
LEFT JOIN qanday vazifani bajaradi?
RIGHT JOIN qanday vazifani bajaradi?
CROSS JOIN qanday vazifani bajaradi?
FULL OUTER JOIN qanday vazifani bajaradi?
Do'stlaringiz bilan baham: |