Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Item #1: Develop scripts to INSERT data into Instructor, and Student tables. Loa

ID: 3787441 • Letter: I

Question

Item #1:

Develop scripts to INSERT data into Instructor, and Student tables. Load the tables with sample data with at least 10 rows.

Instructor

Name

Data Type

Constraint

Address

Nvarchar (100)

Not Null

InstructorID

Int

Primary Key

Phone Number

Nvarchar(10)

Not null

Office

Int

Not null

Office Hours

Nvarchar (30)

Not null

Department

Nvarchar (15)

Not null

Department ID

Int

Not null

First Name

Nvarchar (30)

Not null

Last Name

Nvarchar (30)

Not null

Student

Name

Data Type

Constraint

Address

Nvarchar (100

Not Null

StudentID

Int

Primary Key

Phone Number

Nvarchar(10)

Not null

Major

Char (10)

Not null

GPA

Decimal (3,2)

Not null

First Name

Nvarchar (30)

Not null

Last Name

Nvarchar (30)

Not null

I tried to entering data into the table for “Instructor” using the following information:

INSERT INTO Instructor(Address,InstructorID, [Phone Number], Office, [Office Hours], Department, [Department ID], [First Name], [Last Name])

VALUES ('240 Campus St','301008','808-555-1234', 'A123', '0800 - 1300', 'History', 'HIS', 'Steve', 'McGarrett');

And received the following error message:

Msg 8152, Level 16, State 4, Line 1

String or binary data would be truncated.

The statement has been terminated.

Item #2:

Construct and execute queries that match the following criteria:

List all classes sorted by course number followed by course name.

List all instructors by last name followed by first name.

List all instructors by last name, first name, InstructorID.

List all instructors by last name followed by first name.

List all students by last name, first name, GPA, Major.

Name

Data Type

Constraint

Address

Nvarchar (100)

Not Null

InstructorID

Int

Primary Key

Phone Number

Nvarchar(10)

Not null

Office

Int

Not null

Office Hours

Nvarchar (30)

Not null

Department

Nvarchar (15)

Not null

Department ID

Int

Not null

First Name

Nvarchar (30)

Not null

Last Name

Nvarchar (30)

Not null

Explanation / Answer

Item#1- You are trying to store [office] value as an A-123 .As office coloum is of type Int it is not going to store string type of value.Same as for coloum [Department] value as in "HIS" you given data type int and you are trying to store string.

So Solution is change the schema of table instructor

office nvarchar(30),department nvarchar(50)

then try this it will work fine.

Item2#

select * from classes order by courseNumber,courseName;

select * from instructor order by lastName,firstName;

select * from instructor order by lastName,firstName,instructorId;

select * from instructor order by lastName,firstName;

select * from students order by lastName,firstName,gpa,major;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote