Is using Natural Join or Implicit column names not a good practice when writing SQL in a programming
- by Jian Lin
When we use Natural Join, we are joining the tables when both table have the same column names. But what if we write it in PHP and then the DBA add some more fields to both tables, then the Natural Join can break?
The same goes for Insert, if we do a
insert into gifts values (NULL, "chocolate", "choco.jpg", now());
then it will break the code as well as contaminating the table when the DBA adds some fields to the table (example as column 2 or 3). So it is always best to spell out the column names when the SQL statements are written inside a programming language and stored in a file in a big project.