Question: Execute the SQL statement at the beginning of Exercise 7 . 1 4 to reset the two tables and their relationship before this exercise. IF

Execute the SQL statement at the beginning of Exercise 7.14 to reset the two tables and their relationship before this exercise.
IF OBJECT_ID(N'Chapter7Exercise.Courses') IS NOT NULL
DROP TABLE Chapter7Exercise.Courses;
IF OBJECT_ID(N'Chapter7Exercise.Instructors') IS NOT NULL
DROP TABLE Chapter7Exercise.Instructors;
CREATE TABLE Chapter7Exercise.Instructors
(
InstructorId INT IDENTITY,
InstructorName NVARCHAR(100) NOT NULL,
Office NVARCHAR(50) NULL,
CONSTRAINT pk_Instructors PRIMARY KEY(InstructorId)
);
CREATE TABLE Chapter7Exercise.Courses
(
CourseId INT IDENTITY,
CourseNumber NVARCHAR(10) NOT NULL,
CourseTitle NVARCHAR(200) NULL,
InstructorId INT NULL,
CONSTRAINT pk_Courses PRIMARY KEY(CourseId),
CONSTRAINT fk_Courses_Instructors
FOREIGN KEY (InstructorId)
REFERENCES Chapter7Excercise.Instructors(InstructorId)
);
SET IDENTITY_INSERT Chapter7Exercise.Instructors ON;
(CourseNumber, CourseTitle, InstructorId)
VALES
(1, 'Ralph Moore', 'Tiger 301');
SET IDENTITY_INSERT Chapter7Excercise.Instructors OFF;
INSERT INTO Chapter7Exercise.Courses
(CourseNumber,CourseTitle, InstructorId)
VALUES
('CS101', 'Instroduction to Database', 1);
(CourseNumber, CourseTitle, InstructorId)
VALUES
('CS102', 'Advanced T-SQL',1);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!