szubert

lab 21.10 databases

Oct 21st, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.96 KB | None | 0 0
  1. create table exams (
  2. exam_id int identity(1,1) not null,
  3. student_id int not null,
  4. tutor_id int not null,
  5. subject_id int not null,
  6. exam_date date not null,
  7. place_id int not null,
  8. constraint student_foreign Foreign key (student_id) References students(student_id) on update cascade on delete no action,
  9. constraint tutor_foreign Foreign key (tutor_id) References tutors(tutor_id) on update cascade on delete no action,
  10. constraint subject_foreign Foreign key (subject_id) References subjects(subject_id) on update cascade on delete no action,
  11. constraint place_foreign Foreign key (place_id) References places(place_id) on update cascade on delete no action,
  12. constraint prim_exam primary key (exam_id)
  13.  
  14. )
  15.  
  16. alter table students add constraint not_less check(10000 < zip_code and zip_code < 99999 );
  17.  
  18. create table new_places (
  19. place_id int identity(1,1) not null constraint prim_new primary key(place_id),
  20. building varchar(10) not null,
  21. audience varchar(10) not null
  22. )
Advertisement
Add Comment
Please, Sign In to add comment