SHARE
TWEET

Untitled

a guest Oct 18th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create database if not exists Tema10;
  2. use Tema10;
  3.  
  4. create table if not exists companie
  5. (nume_companie varchar(50)unique primary key,
  6. id int
  7. );
  8.  
  9. create table if not exists adresa
  10. (cod_postal int primary key,
  11. oras varchar(50),
  12. strada varchar(50)
  13. );
  14.  
  15. create table if not exists locuinta
  16. (id int primary key,
  17. foreign key(id)references adresa(cod_postal));
  18.  
  19. create table if not exists cladire_birouri
  20. (id int primary key,
  21. nr_locuri_parcare int,
  22. foreign key(id)references adresa(cod_postal)
  23. );
  24.  
  25. create table if not exists apartamente
  26. (id int primary key,
  27. nr_camere int,
  28. foreign key (id)references locuinta(id));
  29.  
  30. create table if not exists persoana
  31. (id int unique primary key,
  32. nume varchar(50),
  33. foreign key(id)references apartamente(id)
  34. );
  35.  
  36. create table if not exists telefon
  37. (nr_tel int primary key,
  38. id int,
  39. foreign key (id) references persoana(id)
  40. );
  41.  
  42. create table if not exists birou
  43. (id int unique primary key,
  44. conexiune_internet int,
  45. foreign key (id)references cladire_birouri(id)
  46. );
  47.  
  48. create table if not exists firma
  49. (nume varchar(50) unique primary key,
  50. nr_fiscal int,
  51. id int,
  52. foreign key (nr_fiscal)references birou(id)
  53. );
  54.  
  55. create table if not exists inchiriator
  56. (id int primary key,
  57. data_inchiriere int,
  58. foreign key (id)references firma(id),
  59. foreign key (id)references persoana(id)
  60. );
  61.  
  62. create table if not exists chirie_birou
  63. (suma int primary key,
  64. foreign key(suma)references birou(id)
  65. );
  66.  
  67. create table if not exists chirie_apartament
  68. (suma int primary key,
  69. foreign key(suma)references apartament(id)
  70. );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top