surfmuggle / Cubert

To become a jedi one must start as a novice
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

SQL - Sprachentabelle #48

Open surfmuggle opened 3 years ago

surfmuggle commented 3 years ago

Für Aufgabe 6 ein erster Entwurf der Tabellen

CREATE TABLE land (
LNR varchar(15)PRIMARY KEY  NOT NULL,
Name varchar(255) NOT NULL
);
CREATE TABLE sprache(
SprachID INT NOT NULL auto_increment,
Name varchar(255) NOT NULL,
PRIMARY KEY(SprachID)
);

CREATE TABLE laendersprache (
FOREIGN KEY (LNR) REFERENCES land(LNR) PRIMARY KEY,
FOREIGN KEY (SprachID) REFERENCES sprache(SprachID),
Anteil float(3,2)
);

INSERT INTO 
    land(LNR, Name)
VALUES
    ('GER', 'Germany'),
    ('CHE', 'Swiss'),
    ('A', 'Austria');

INSERT INTO 
    sprache(Name)
VALUES
    ('German'),
    ('Italian'),
    ('French');

INSERT INTO 
    laendersprache(Name, SprachID)
VALUES
    ('GER', 1),
    ('CHE', 1),
    ('CHE', 2),
    ('CHE', 3);