View the step-by-step solution to:

create table Employee (EmpNo char(8), EmpFirstName varchar(20) constraint EmpFirstNameRequired not null, EmpLastName varchar(30) constraint

create table Employee

(EmpNo char(8),

EmpFirstName varchar(20) constraint EmpFirstNameRequired not null,

EmpLastName varchar(30) constraint EmpLastNameRequired not null,

EmpPhone char(15),

EmpEmail varchar(50) constraint EmpEmailRequired not null,

SupEmpNo char(8),

EmpCommRate decimal(3,3),

constraint pk_Employee primary key (EmpNo),

constraint UQ_Email unique (EmpEmail),

constraint fk_SupEmpNo foreign key (SupEmpNo) references Employee)


I am having trouble when trying to add data to this table.


insert Employee

select 'E1329594', 'Landi', 'Santos', '(303 789-1234', 'Emailaddress', 'E8843211', 0.02


I get an error message.


Msg 547, Level 16, State 0, Line 69

The INSERT statement conflicted with the FOREIGN KEY SAME TABLE constraint "fk_SupEmpNo". The conflict occurred in database "Homework6", table "dbo.Employee", column 'EmpNo'.

The statement has been terminated.


I know the foreign key is a self-referencing (unary) relationship to itself but I am not sure what I need to do to be able to insert the data without errors.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question