Advertisement
Maks140888

Untitled

May 27th, 2022
716
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create table task (
  2.     id number not null,
  3.     title varchar (50),
  4.     constraint tasks_pk primary key (id)
  5. );
  6.  
  7. create table user_web (
  8.     id number not null,
  9.     name varchar(50),
  10.     constraint user_id primary key (id)
  11. );
  12.  
  13. create table solution (
  14.     id number not null,
  15.     student_id number not null,
  16.     task_id number not null,
  17.     sent_date date,
  18.     CONSTRAINT solutions_pk PRIMARY KEY (id),
  19.     CONSTRAINT fk_studentt_id
  20.         FOREIGN key (student_id)
  21.         references user_web (id),
  22.    CONSTRAINT fk_taskk_id
  23.         FOREIGN key (task_id)
  24.         references task (id)
  25. );
  26.  
  27. create table grades (
  28.     solution_id number not null,
  29.     tutor_id number not null,
  30.     grade number,
  31.     grade_date date,
  32.     CONSTRAINT fk_solutions_id
  33.         FOREIGN key (solution_id)
  34.         references solution (id),
  35.    CONSTRAINT fk_tutor_id
  36.         FOREIGN key (tutor_id)
  37.         references user_web (id)
  38. );
  39.  
  40. INSERT INTO user_web (ID, NAME) VALUES (1, 'Danil');
  41. INSERT INTO user_web (ID, NAME) VALUES (2, 'Kiril');
  42. INSERT INTO user_web (ID, NAME) VALUES (3, 'Maxim');
  43.  
  44. insert into task (id, title) values (0, 'Rp_01');
  45. insert into task (id, title) values (1, 'Rp_02');
  46. insert into task (id, title) values (2, 'Rp_03');
  47. insert into task (id, title) values (3, 'Rp_04');
  48. insert into task (id, title) values (4, 'Rp_05');
  49.  
  50. insert into user_web (id, name) VALUES (4, 'Olga Kovalenko');
  51. insert into user_web (id, name) VALUES (5, 'Oleg Kuzikov');
  52.  
  53. insert into solution (id, student_id, task_id, sent_date)
  54. VALUES (1, 3, 0, to_date('2022-04-23','YYYY-MM-DD'));
  55.  
  56. insert into solution (id, student_id, task_id, sent_date)
  57. VALUES (2, 3, 1, to_date('2022-04-25','YYYY-MM-DD'));
  58.  
  59. insert into solution (id, student_id, task_id, sent_date)
  60. VALUES (3, 1, 0, to_date('2022-04-26','YYYY-MM-DD'));
  61.  
  62. insert into solution (id, student_id, task_id, sent_date)
  63. VALUES (4, 1, 1, to_date('2022-04-27','YYYY-MM-DD'));
  64.  
  65. insert into grades (solution_id, tutor_id, grade, grade_date)
  66. VALUES (1, 4, 50, to_date('2022-04-27','YYYY-MM-DD'));
  67.  
  68. insert into grades (solution_id, tutor_id, grade, grade_date)
  69. VALUES (2, 4, 80, to_date('2022-04-29','YYYY-MM-DD'));
  70.  
  71. insert into grades (solution_id, tutor_id, grade, grade_date)
  72. VALUES (3, 5, 40, to_date('2022-04-28','YYYY-MM-DD'));
  73.  
  74. insert into grades (solution_id, tutor_id, grade, grade_date)
  75. VALUES (4, 5, 90, to_date('2022-04-30','YYYY-MM-DD'));
  76.  
  77. insert into grades (solution_id, tutor_id, grade, grade_date)
  78. VALUES (0, 4, 60, to_date('2022-04-25','YYYY-MM-DD'));
  79.  
  80.  
Advertisement
RAW Paste Data Copied
Advertisement