DarkSQL by Darkleo.com
DarkSQL
Legen Sie eine neue Datenbank ‚Fachhochschule’ an.
Student |
|||||
Matrikelnr |
Name |
Fachbereich |
Fachsemester |
Geb_Dat |
Geschlecht |
Schlüssel: Matrikelnr, Geschlecht: w / m, Fachbereich: 1-9
drop table
Student cascade
constraints; --Tabelle Student anlegen create table Student( Matrikelnr char(8) not null, Name char(20), Fachbereich int check( Fachbereich between 1 and 9), Fachsemester char(10), Geb_Dat date, Geschlecht char check (Geschlecht='m' or Geschlecht='w'), primary key (Matrikelnr) ); |
Dozent |
||
Name |
Fachbereich |
Lehrgebiet |
Schlüssel: Name
drop table
Dozent cascade
constraints; --Tabelle Dozent anlegen create table Dozent( Name char(20), Fachbereich int check( Fachbereich between 1 and 9), Lehrgebiet char(20), primary key (Name) ); |
Vorlesung | |||||
Vorl_Nr | Hoersaal |
Plätze |
Beginn_h |
Ende_h |
Dozent |
Schlüssel: Vorl_Nr, Plätze: 20-500, Fremdschlüssel: Dozent auf Tabelle Dozent, Feld Name
drop table
Vorlesung cascade
constraints; --Tabelle Vorlesung anlegen create table Vorlesung( Vorl_Nr int, Hoersaal char(10), Plaetze int check (Plaetze between 20 and 500), Beginn_h int, Ende_h int, Dozent char(20) , primary key (Vorl_Nr, Plaetze), foreign key (Dozent) references Dozent(Name) ); |
Hoert | |
Student |
Vorlesung |
Schlüssel: Student und Vorlesung, Fremdschlüssel: Student auf Tabelle Student, Feld Matrikelnr, Vorlesung auf Tabelle Vorlesung Feld Vorl_Nr
drop table Hoert cascade constraints; --Tabelle Hoert anlegen create table Hoert( Student char(8), Vorlesung int, primary key (Student,Vorlesung), foreign key (Student) references Student(Matrikelnr) ); |
Klausurergebnis | |||
Student |
Fach |
Klausur_Datum |
Ergebnis |
Schlüssel: Student und Fach und Klausur_Datum, Fremdschlüssel: Student auf Tabelle Student, Feld Matrikel_Nr
drop table
Klausurergebnis cascade constraints; --Tabelle Klausurergebnis anlegen create table Klausurergebnis( Student char(8) not null, Fach int, Klausur_Datum date, Ergebnis float, primary key (Student, Fach, Klausur_Datum), foreign key (Student) references Student(Matrikelnr) ); |
drop table
Student
cascade constraints; drop table Dozent cascade constraints; drop table Vorlesung cascade constraints; drop table Hoert cascade constraints; drop table Klausurergebnis cascade constraints; --Tabelle Student anlegen create table Student( Matrikelnr char(8) not null, Name char(20), Fachbereich int check( Fachbereich between 1 and 9), Fachsemester char(10), Geb_Dat date, Geschlecht char check (Geschlecht='m' or Geschlecht='w'), primary key (Matrikelnr) ); --Tabelle Dozent anlegen create table Dozent( Name char(20), Fachbereich int check( Fachbereich between 1 and 9), Lehrgebiet char(20), primary key (Name) ); --Tabelle Vorlesung anlegen create table Vorlesung( Vorl_Nr int, Hoersaal char(10), Plaetze int check (Plaetze between 20 and 500), Beginn_h int, Ende_h int, Dozent char(20) , primary key (Vorl_Nr, Plaetze), foreign key (Dozent) references Dozent(Name) ); --Tabelle Hoert anlegen create table Hoert( Student char(8), Vorlesung int, primary key (Student,Vorlesung), foreign key (Student) references Student(Matrikelnr) ); --Tabelle Klausurergebnis anlegen create table Klausurergebnis( Student char(8) not null, Fach int, Klausur_Datum date, Ergebnis float, primary key (Student, Fach, Klausur_Datum), foreign key (Student) references Student(Matrikelnr) ); |