RE: Standard of Column Names

2004-05-02 Thread Matt Chatterley
To me, this is entirely a matter of personal choice - and the important
thing is to pick a standard and stick to it. :)

I usually end up with a table called 'People' for arguments sake, which will
have an abstract PK (auto increment int) called PeopleID (I always use the
table name). I also capitalize each word (and all abbreviations), which is a
habit from MSSQL programming - MySQL is case sensitive, which is worth
remembering. I use underscores to indicate that a table is a 'glue' table -

e.g. If each row in People can correspond to multiple rows in the table
Jobs, and vice versa, I would create People_Jobs to describe the
relationship between the two.

There are a number of different methods that have been published, including
'Norwegian', I believe - and a bit of googling should turn up some info on
these. :)

Cheers,

Matt

 -Original Message-
 From: Ronan Lucio [mailto:[EMAIL PROTECTED]
 Sent: 27 April 2004 15:46
 To: [EMAIL PROTECTED]
 Subject: Standard of Column Names
 
 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)?
 
 Thanks,
 Ronan
 
 
 
 
 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




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



Re: Standard of Column Names

2004-04-27 Thread Ruslan U. Zakirov
Ronan Lucio wrote:
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)?
		Hello.
IMHO:
1) Table name as prefix is unnecessary for me. It's norwegian notation 
which I hate.
2) Also I recomend look into ANSI SQL standard for reserved keywords. 
I've got experience of porting DB from MySQL(allow some keywords) to 
another DB, it's pain.

		Good luck. Ruslan.

Thanks,
Ronan





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


Re: Standard of Column Names

2004-04-27 Thread Ronan Lucio
Ruslan,

 IMHO:
 1) Table name as prefix is unnecessary for me. It's norwegian notation
 which I hate.
 2) Also I recomend look into ANSI SQL standard for reserved keywords.
 I've got experience of porting DB from MySQL(allow some keywords) to
 another DB, it's pain.

Thank you your answer.
Do you know where can I find a documentation about ANSI SQL Standards
and what is the ANSI SQL standard implemented by MySQL?

I ask it because I´ll prefer to work with column types that
are in the ANSI SQL Stantard like INTEGER instead of
MEDIUMINT.

Thanks,
Ronan



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



Re: Standard of Column Names

2004-04-27 Thread Ronan Lucio
Harald,

 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

Do you know how it would be about portability?

Thanks,
Ronan



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



Re: Standard of Column Names

2004-04-27 Thread Michael Stassen
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]