Tutorium 3 reationships

This commit is contained in:
2025-01-25 15:58:57 +01:00
commit 37c749c030

23
tutorium_3_relationships Normal file
View 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
;