1

Here i am trying to run one query in MySQL editor and getting one problem

Here is my query

select *
FROM my_db.persons FULL JOIN 
my_db.employee
ON persons.PersonID=employee.PersonID;

Any help would be appreciated

Ketan G
  • 507
  • 1
  • 5
  • 21

2 Answers2

1

Check if PersonID column exists on Persons table. Make sure the spellings are exactly the same as in the table structure. Also check the case. Some IDE are case sensitive.

Erick Kamamba
  • 268
  • 1
  • 4
1

MySQL doesn't support FULL JOIN, so perhaps that is the problem. In any case, I prefer shorter table aliases:

select *
FROM my_db.persons p LEFT JOIN 
     my_db.employee e
     ON p.PersonID = e.PersonID;

This, of course, assumes that the PersonID column exists in both tables.

Oh, I see why you got the error. Perhaps this will explain:

select *
FROM my_db.persons full JOIN 
     my_db.employee e
     ON full.PersonID = e.PersonID;

That is, because MySQL doesn't support FULL JOIN, the full is treated as a table alias.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786