- #1
mathmari
Gold Member
MHB
- 5,049
- 7
Hey!
Consider the relations Personen, Hotel and BuchungH :
1. Create the three relations in the database.
2. Insert the tuples in all tables.
3. Create meaningful keystones for all tables.
4. Give an expression that deletes again the tables. Could you explain to me what we are supposed to do? Do we have to create the tables with SQL commands? :unsure:
If it is like that, then do we have the following at 1 ?
CREATE TABLE Personen (
PID int,
Name varchar(255),
);
CREATE TABLE Hotel (
HID int,
Name varchar(255),
Ort varchar(255),
);
CREATE TABLE BuchungH (
Bnr int,
PID int,
HID int,
von int,
bis int,
); Is everything correct and complete? The length of 255 is standard? Or does it depend each time on the specific table? :unsure: At 2 do we have the following ?
INSERT INTO Personen
VALUES ('1', 'Schmidt'),
('2', 'Meier'),
('3', 'Beier'),
('4', 'Bauer'),
('5', 'Wolf');
INSERT INTO Hotel
VALUES ('1', 'Beach Club', 'Mallorca'),
('2', 'Radisson', 'Mallorca'),
('3', Le Flaubert', 'Nizza'),
('4', 'Ibis', 'Nizza'),
('5', 'Ibis', 'Mailand');
INSERT INTO BuchungH
VALUES ('1', '1', '1', '20211030', '20211107'),
('2', '2', '1', '20211030', '20211107'),
('3', '3', '4', '20211031', '20211104'),
('4', '3', '2', '20211030', '20211107'),
('5', '4', '4', '20211031', '20211108');
Is everything correct and complete? :unsure: Could you explain to me questions 3 and 4 ? :unsure:
Consider the relations Personen, Hotel and BuchungH :
1. Create the three relations in the database.
2. Insert the tuples in all tables.
3. Create meaningful keystones for all tables.
4. Give an expression that deletes again the tables. Could you explain to me what we are supposed to do? Do we have to create the tables with SQL commands? :unsure:
If it is like that, then do we have the following at 1 ?
CREATE TABLE Personen (
PID int,
Name varchar(255),
);
CREATE TABLE Hotel (
HID int,
Name varchar(255),
Ort varchar(255),
);
CREATE TABLE BuchungH (
Bnr int,
PID int,
HID int,
von int,
bis int,
); Is everything correct and complete? The length of 255 is standard? Or does it depend each time on the specific table? :unsure: At 2 do we have the following ?
INSERT INTO Personen
VALUES ('1', 'Schmidt'),
('2', 'Meier'),
('3', 'Beier'),
('4', 'Bauer'),
('5', 'Wolf');
INSERT INTO Hotel
VALUES ('1', 'Beach Club', 'Mallorca'),
('2', 'Radisson', 'Mallorca'),
('3', Le Flaubert', 'Nizza'),
('4', 'Ibis', 'Nizza'),
('5', 'Ibis', 'Mailand');
INSERT INTO BuchungH
VALUES ('1', '1', '1', '20211030', '20211107'),
('2', '2', '1', '20211030', '20211107'),
('3', '3', '4', '20211031', '20211104'),
('4', '3', '2', '20211030', '20211107'),
('5', '4', '4', '20211031', '20211108');
Is everything correct and complete? :unsure: Could you explain to me questions 3 and 4 ? :unsure: