Re: Queries and Common Practices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 10:50 AM +0100 5/22/11, Ashley Sheridan wrote:
-snip-

 but I also give the table a moniker which lets me shorten the
queries as I type:

SELECT p.id, p.name FROM people p WHERE p.gender = 'male'

This way, I can easily join in other tables, my typing is kept to a
minimum as I do it also.


Ash:

Whenever I see p.id (or similar) I think there is a join coming.

So, I always use:

SELECT id, name FROM people WHERE gender = 'male'

Unless there a join, such as:

SELECT p.id, p.name, a.total FROM people p, accounts.a WHERE gender = 'male'

Cheers,

tedd

--
-------
http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux