Below is my create tables for a database using SQL. I can't figure out how to get a name displayed for both ID and LIKED from the likes table. This assignment should be simple, be able to display the names of people that like each other. There is a data entry form that requires IDs to be entered for the people that like each other, but then I have to display the names of both of the people that like each other.... I hope I didn't make this confusing. Is it possible for some sql code to display the names of who likes who.
CREATE TABLE person ( ID INT PRIMARY KEY, NAME VARCHAR(50) ) engine=innodb; CREATE TABLE likes ( ID INT, LIKED INT, constraint likesPK primary key(ID,LIKED), constraint personFK foreign key(ID) references person(ID) on delete cascade on update cascade, constraint nameFK foreign key(LIKED) references person(ID) on delete cascade on update cascade ) engine=innodb;
Example of what I have tried to do but needs one more column to display the person "LIKED":
select B.id, B.name, A.lIKED from likes A, person B where A.id=B.id AND A.id = 1;
PLEASE AND THANK YOU!