0

hi
if i have table employee with employee_id as a primary key
how can i assign the primary key to the columns firstname and lastname?

table structure is something like this :

employee_id int not null, firstname varchar(20) not null, lastname varchar(20) not null
the problem is that there is a foreign key in other table that referes to the table employee , so when i try to delete the primary key i get error said i can't delete coze it refers to other table ...

other q
if i create foreign key by this way
alter table le_order
add constraint fk_salesman foreign key (Salesman_id) REFERENCES employee
how can i update this statement and add
on delete set null
and to set it to null is that correct for first problem

thx
note : sorry my english isn't good , if you please excuse me.

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by web_developer
0

mike
the first problem is called referential integrity, u cant delete a row with an id and its found in another table as foreign id, u have first to delete in the second table. Its wrong to put the first name and last name as primary key. keep the primary id as it is.

about the second question, i didnt understand wht u mean, can u rephrase it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.