- #1
mathmari
Gold Member
MHB
- 5,049
- 7
Hey! :giggle:
Consider the followingrelations for the database of a mail-order company.
Kunde(KNr, Nachname, Vorname, Strasse, Hausnr, PLZ, Ort)
Artikel(ArtNr, PreisProStuck, Bezeichnung, Gewicht)
Bestellung(KNr, ArtNr, Anzahl, Bestelldatum)
1. Think about which attributes are useful primary keys in the individual relations.
2. Are there foreign keys? If so, indicate these with the attributes to which the foreign key relate. Which behavior makes sense in the individual cases, if a value of the primary key, to which the foreign key refers is changed (update)? Which behavior makes sense at Deleting such values?
3. Are there reasonable conditions for the individual attributes? Give for each attribute at least one property (at least the data type) and possibly a condition that must always be fulfilled. Hint: Conditions refer to the type, key and reference integrity. I have done the following :
1. Primary keys is the column that is characteristic for a table, like the ID number, where each entry is unique, right?
Therefore, at the table "Kunde" the primary key is the attrubute "KNr", at the table "Artikel" the primary key is the attrubute "ArtNr", right?
At the table "Bestellung" which is the primary key? Maybe one of the first two attributes? Or can it not be that one attribute is the primary key for more than one table? The "Anzahl" which gives us the number of items that have been ordered must not be unique, right? The same holds also for the date of order, right?
:unsure: 2. Foreign keys are the primary keys of one table that are also in an other table,or non? That means that in the table "Bestellung" we have "KNr" and "ArtNr" which are the primary keys of the first two tables.
Is that correct? Or have I misunderstood the meaning of foreign keys? :unsure: 3. I haven't really understood what this question asks for. Could you explain that further to me? :unsure:
Consider the followingrelations for the database of a mail-order company.
Kunde(KNr, Nachname, Vorname, Strasse, Hausnr, PLZ, Ort)
Artikel(ArtNr, PreisProStuck, Bezeichnung, Gewicht)
Bestellung(KNr, ArtNr, Anzahl, Bestelldatum)
1. Think about which attributes are useful primary keys in the individual relations.
2. Are there foreign keys? If so, indicate these with the attributes to which the foreign key relate. Which behavior makes sense in the individual cases, if a value of the primary key, to which the foreign key refers is changed (update)? Which behavior makes sense at Deleting such values?
3. Are there reasonable conditions for the individual attributes? Give for each attribute at least one property (at least the data type) and possibly a condition that must always be fulfilled. Hint: Conditions refer to the type, key and reference integrity. I have done the following :
1. Primary keys is the column that is characteristic for a table, like the ID number, where each entry is unique, right?
Therefore, at the table "Kunde" the primary key is the attrubute "KNr", at the table "Artikel" the primary key is the attrubute "ArtNr", right?
At the table "Bestellung" which is the primary key? Maybe one of the first two attributes? Or can it not be that one attribute is the primary key for more than one table? The "Anzahl" which gives us the number of items that have been ordered must not be unique, right? The same holds also for the date of order, right?
:unsure: 2. Foreign keys are the primary keys of one table that are also in an other table,or non? That means that in the table "Bestellung" we have "KNr" and "ArtNr" which are the primary keys of the first two tables.
Is that correct? Or have I misunderstood the meaning of foreign keys? :unsure: 3. I haven't really understood what this question asks for. Could you explain that further to me? :unsure: