Bunich

dbtest

Apr 17th, 2018
64
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create table Istruttore(CodFisc char(16) not null primary key,
  2. Nome char(20) not null,
  3. Cognome char(20) not null,
  4. DataNascita datetime not null,
  5. Email char(20),
  6. Telefono char(15) default null unique);
  7.  
  8. create table corsi(CodC char(5) not null primary key,
  9. Nome char(50) not null,
  10. Tipo char(20),
  11. Livello smallint check(Livello>0));
  12.  
  13. create table Programma(CodFisc char(16) not null,
  14. Giorno char(10) not null,
  15. OraInizio time not null,
  16. Durata smallint not null check(Durata>0),
  17. Codc char(5) not null,
  18. Sala char(2) not null,
  19. primary key(CodFisc,Giorno,OraInizio),
  20. foreign key(CodFisc) references istruttore
  21. on delete cascade
  22. on update cascade,
  23. foreign key(CodC) references corsi
  24. on delete cascade
  25. on update cascade);
RAW Paste Data