Harald Fuchs wrote:


In article <[EMAIL PROTECTED]>,
"Ronan Lucio" <[EMAIL PROTECTED]> writes:


Hello,
I´m doing the planing for an application that will use
MySQL as database.


So, I´d like to know your opinions about the standard
for the column names.


Supposing that I should create a table named car.
Is it better to have either the column names (cod,
name, description) or (car_cod, car_name, car_description)?


I don't see the necessity of the latter naming scheme since

SELECT cod, name, description FROM car

can also be written as

SELECT car.cod, car.name, car.description FROM car

Right. In general, adding the table name to the column names just results in more typing, and the manual <http://dev.mysql.com/doc/mysql/en/Tips.html> explicitly recommends keeping column names short and simple:


Columns with identical information in different tables should be declared to
have identical data types. Before Version 3.23, you got slow joins
otherwise. Try to keep the names simple. For example, in a table named
customer, use a column name of name instead of customer_name. To make your
names portable to other SQL servers, you should keep them shorter than 18
characters.

On the other hand, there was a poster recently who had a lot of tables with identical column names who was looking for a way to get the table name included in the column name header in mysql output. As he wanted an automatic solution, rather than typing in all the aliases by hand, he might have benefited from this sort of table_col naming scheme.


Michael



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to