Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
5. 6.
create table ft_student ( id_no integer not null, grade integer, primary key(id_no) ) 11. Type then execute create table pt_student ( id_no integer not null, primary key(id_no) ) 12. Type then execute alter table course add course_name varchar (50) null 13. Type then execute alter table course add credit integer null 14. Type then execute alter table course add teacher_name varchar (50) null 15. Type then execute create table previous_course_required ( course_no integer not null, previous_course_no varchar(100) not null, primary key (previous_course_no), foreign key (course_no) references course(course_no) ) 16. Type then execute create table students_registered ( course_no integer not null, id_no integer not null, primary key (course_no, id_no), foreign key (course_no) references course(course_no), foreign key (id_no) references student(id_no) ) 17. Type then execute insert into person (id_no, name, birth_date, height, weight) values (1, 'John Doe', 'mar 1, 1997 0:0:0.0', 1.11, 1.11) 18. Type then execute insert into person (id_no, name, birth_date, height, weight) values (2, 'Able Chitson', 'mar 2, 1997', 2.22, 2.22) 19. Type then execute Page 2 of 4
insert into person (id_no, name, birth_date, height, weight) values (3, 'Chris Bloor', 'mar 3, 1997', 3.33, 3.33) 20. Type then execute insert into student (id_no, student_id, dept_name, course_taken) values (3, 3, 'Computer Science', 4) 21. Type then execute insert into course (course_no, course_name, credit, teacher_name) values (4, 'Database', 3, 'Peter Smith') 22. Type then execute insert into course (course_no, course_name, credit, teacher_name) values (5, 'Data Engineering', 5, 'Mike Denny') 23. Type then execute insert into person (id_no, name, birth_date, height, weight) values (5, 'Keith Reagon', 'mar 5, 1997', 5.55, 5.55) 24. Type then execute insert into student (id_no, student_id, dept_name, course_taken) values (5, 5, 'Computer Science', 0) 25. Type then execute insert into ft_student (id_no, grade) values (5, 5) 26. Type then execute insert into previous_course_required (course_no, previous_course_no) values (4, 'CS101') 27. Type then execute insert into previous_course_required (course_no, previous_course_no) values (4, 'CS102') 28. Type then execute insert into students_registered (course_no, id_no) values (4, 3) 29. Type then execute insert into students_registered (course_no, id_no) values (5, 3) 30. Type then execute select * from course 31. Type then execute Page 3 of 4
select * from person 32. Type then execute select * from ft_student 33. Type then execute create proc show_person as select * from person return 34. 28 35. Type then execute show_person Type then execute create proc show_course @incourse_no integer as select * from course where course_no = @incourse_no return 36. 29 Type then execute execute show_course 4
System Tables
In schema translation design, the database schema from source database is extracted using MS SQL server's system tables. System tables are tables used to store information about the system (the database catalog) or an individual database (the database catalog). MS SQL Server system tables used by our schema translation are shown in following table. Metadata of source database is extracted from system tables.
sysobjects sysreferences
Page 4 of 4