I have been working on a class methods for some time now.
I have reached a cross road when it comes to common practice of developing
query structure.
Long ago I wrote queries where I just called the field I wanted on a
particular table unless I was joining them.
Example:
$query = " SELECT id FROM Table WHERE Clause";
Through time I developed a habit of queering as such.
Example:
$query = "SELECT tablename.id FROM db.table WHERE clause";
I have felt that, because my server contains multiple databases and I needed
to jump between databases and tables without changing the connector this
always has been best practice for me.
Someone recently told me,
Rich,
I do not agree with your design of the queries.
There is no need to include the DB and table name in the query if you are
not joining tables.
While I have a very hard time understanding this response as being valid. I
will propose the question.
Is it bad practice to write queries with the database and table name in the
queries even if I am NOT joining tables?
Is there an impact from PHP or MySQL that is caused by doing so?
I know this more a MySQL question but as PHP developers we all deal with
queries on a day to day bases,
and when developing more flexible class methods I build the queries in the
method.
Richard L. Buskirk