MHB Relation between Sets AUFTRAG & KUNDE

  • Thread starter Thread starter mathmari
  • Start date Start date
  • Tags Tags
    Relations Sets
Click For Summary
The discussion focuses on the relationships between the sets AUFTRAG and KUNDE, specifically examining their union, intersection, and Cartesian product. Participants clarify the definitions of these operations and the implications of combining the sets, noting that the union requires compatible column headers. They explore whether elements from AUFTRAG can be matched with those from KUNDE based on shared attributes, particularly KUNDNR. The conversation also highlights the importance of understanding tuple structures and set compatibility in relational databases. Ultimately, it concludes that the union cannot be performed due to mismatched column headers, emphasizing the need for uniformity in data structure.
  • #61
mathmari said:
Do we maybe write :

Expression for 1 :
SELECT KUNDE.kundnr, KUNDE.ort
FROM KUNDE

That is effectively the same as before.

I think it might be:
SELECT k1.kundnr, k2.ort
FROM KUNDE k1, KUNDE k2
:unsure:


mathmari said:
So we need in these cases "DISTINCT", right?

In question 2, yes, we can expect that the same customer has multiple orders, so their name will get listed multiple times.
DISTINCT then ensures each name is listed only once. 🤔

In question 3 it is not be necessary. Orders are unique. So if we list the AUFTRAGNR's, we will already have at most one of each. 🤔


mathmari said:
Ah we have to write that this inequality holds for each a in AUTRAG, don't we?

Indeed. (Sweating)
 
Last edited:
Physics news on Phys.org
  • #62
Klaas van Aarsen said:
That is effectively the same as before.

I think it might be:
SELECT k1.kundnr, k2.ort
FROM KUNDE k1, KUNDE k2
:unsure:
So that we consider two different columns? :unsure:
Klaas van Aarsen said:
In question 2, yes, we can expect that the same customer has multiple orders, so their name will get listed multiple times.
DISTINCT then ensures each name is listed only once. 🤔

In question 3 it is not be necessary. Orders are unique. So if we list the AUFTRAGNR's, we will already have at most one of each. 🤔

Indeed. (Sweating)
So do we have to write the following ? Expression for 1 :
SELECT k1.kundnr, k2.ort
FROM KUNDE k1, KUNDE k2 Expression for 2 :
SELECT DISTINCT NAME
FROM KUNDE k, AUFTRAG a
WHERE k.KUNDNR = a.KUNDNRExpression for 3 :
SELECT DISTINCT AUFTRAGNR
FROM AUFTRAG a, KUNDE k
WHERE a.KUNDNR = k.KUNDNR AND (k.ORT = Gießen OR k.ORT = Wetzlar)Expression for 4 :
SELECT DISTINCT KUNDNR
FROM KUNDE k
WHERE k.KUNDNR != ALL
$ \ \ \ \ \ $(SELECT KUNDNR
$ \ \ \ \ \ $FROM AUFTRAG)
:unsure:
 
  • #63
Looks right to me. (Nod)
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
8
Views
2K
  • · Replies 7 ·
Replies
7
Views
990
  • · Replies 22 ·
Replies
22
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K