Is using Natural Join or Implicit column names not a good practice when writing SQL in a programming

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-04-25T11:06:11Z Indexed on 2010/04/25 11:13 UTC
Read the original article Hit count: 305

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql