Tutorium 3 reationships
This commit is contained in:
23
tutorium_3_relationships
Normal file
23
tutorium_3_relationships
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
-- 1-to-1-relationship
|
||||||
|
SELECT *
|
||||||
|
FROM "IDBS01_Q12025"."Population" AS population
|
||||||
|
inner join "IDBS01_Q12025"."Country" as ctry
|
||||||
|
on ctry.code = population.country
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 1-to-cn-relationship
|
||||||
|
SELECT *
|
||||||
|
FROM "IDBS01_Q12025"."Country" as ctry
|
||||||
|
FULL OUTER JOIN "IDBS01_Q12025".borders as borders
|
||||||
|
ON ctry.code = borders.country1
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
-- 1-to-cn-relationship
|
||||||
|
SELECT *
|
||||||
|
FROM "IDBS01_Q12025"."Country" as ctry
|
||||||
|
LEFT OUTER JOIN "IDBS01_Q12025"."geo_Desert" AS geodes
|
||||||
|
ON ctry.code = geodes.country
|
||||||
|
LEFT OUTER JOIN "IDBS01_Q12025"."Desert" AS des
|
||||||
|
on geodes.desert = des.name
|
||||||
|
;
|
||||||
Reference in New Issue
Block a user