Answered You can hire a professional tutor to get the answer.

QUESTION

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.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question