Mysql – theSQL foreign key and primary key

foreign keyjoin;MySQL

Consider table A with columns id (primary key), name and table B with columns id, a_id (foreign key linked with table A id column), address. What will be the sequence of columns if the query is:

SELECT * FROM B INNER JOIN A ON B.a_id = A.id;

Best Answer

What do you mean by "sequence of columns"? One interpretation has to do with SELECT * -- the * will list the columns in definition order, first from B, then from A.

It is generally a bad idea to use SELECT *, at least for production queries.