Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. drop table if exists University;
  2. drop table if exists Teacher;
  3. drop table if exists Subject;
  4. drop table if exists _Group;
  5. drop table if exists Student;
  6. drop table if exists TeacherSubject;
  7. drop table if exists LR;
  8. drop table if exists mark_LR;
  9. drop table if exists all_subject_group;
  10.  
  11. create table University (
  12. id int primary key,
  13. name text,
  14. city text
  15. );
  16.  
  17. create table Teacher (
  18. id int primary key,
  19. login text,
  20. name text,
  21. cathedral text,
  22. rank text,
  23. password text,
  24. is_admin boolean,
  25. id_university int references University (id)
  26. );
  27.  
  28. create table Subject (
  29. id int primary key,
  30. name text
  31. );
  32.  
  33. create table _Group (
  34. id int primary key,
  35. number int
  36. );
  37.  
  38. create table Student(
  39. id int primary key,
  40. login text,
  41. name text,
  42. id_group int references _Group (id),
  43. id_university int references University (id),
  44. password text
  45. );
  46.  
  47. create table TeacherSubject(
  48. id int primary key,
  49. id_teacher int references Teacher (id),
  50. name text
  51. );
  52.  
  53. create table LR(
  54. id int primary key,
  55. id_subject int references Subject (id),
  56. name text
  57. );
  58.  
  59. create table mark_LR(
  60. id int primary key,
  61. mark int,
  62. date timestamp,
  63. id_LR int references LR (id),
  64. id_student int references Student (id)
  65. );
  66.  
  67. create table all_subject_group(
  68. id int primary key,
  69. id_group int references _Group (id),
  70. id_subject int references Subject (id)
  71. );
  72.  
  73. insert into University values (1,'ГУАП','Санкт-Петербург');
  74. insert into University values (2,'Герцена','Санкт-Петербург');
  75. insert into University values (3,'МГУ','Москва');
  76.  
  77. insert into Teacher values (1,'admin','ADM','','','123',true,1);
  78. insert into Teacher values (2,'admin','ADM','','','123',true,2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement