Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
modul:m290:learningunits:lu04:theorie:c_multipletables [2024/09/03 11:37] – [LU04c - Multiple table] vdemirmodul:m290:learningunits:lu04:theorie:c_multipletables [2024/10/17 12:34] (aktuell) vdemir
Zeile 1: Zeile 1:
-====== LU04c Multiple table ======+====== LU06c SQL-DQL: Select from multiple tables ======
  
 Source: [[https://www.w3schools.com/sql/sql_where.asp|W3Schools.co: SELECT with WHERE]] Source: [[https://www.w3schools.com/sql/sql_where.asp|W3Schools.co: SELECT with WHERE]]
  
-As we know, a RDB essentially consists of tables which are linked together to increase quality and performance and reduce unintended redundancies and inconsistencies. If we want to know which orders were placed by which customer we have to deal with the two tables **CUSTOMERS** and **ORDERS**, and the key that connects the two is logically the CustomerID, as shown in the figure below+As we know, a RDB essentially consists of tables which are linked together to increase quality and performance and reduce unintended redundancies and inconsistencies. The following ERD shows such a data structure of a shop including some details.
  
 {{:modul:m290:learningunits:lu04:theorie:erd_customer_orders.drawio.png?900| ERD of a Webshop}} {{:modul:m290:learningunits:lu04:theorie:erd_customer_orders.drawio.png?900| ERD of a Webshop}}
 +
 +If we want to know which orders were placed by which customer we have to deal with the two tables **CUSTOMERS** and **ORDERS**, and the key that connects the two is logically the CustomerID. 
 +
 ===== Select on two tables ===== ===== Select on two tables =====
  
-In real live we would like to know which one particular customer, e.g. with the ID =3,  had ordered, the subsequent SQL statement would be as following:+In practice, we would like to know which customer, e.g. with ID =3, has ordered which product. The following SQL statement would read as follows:
  
   SELECT c.*, o.orderdate    SELECT c.*, o.orderdate 
  • modul/m290/learningunits/lu04/theorie/c_multipletables.1725356224.txt.gz
  • Zuletzt geändert: 2024/09/03 11:37
  • von vdemir