Is it a good practice to name the mysql tables and columns in UPPER CASE?

Such as for the InterBase/FireBird, the column names will be in upper case only when used in php coding.

But for mysql, the column could be in lower case or upper case.

My question is should I always name the mysql tables and columns in upper case? In case I have to switch the php codes to support FireBird database, all I need to do is mass replace mysql_query, my_sql_fetch_object with ibase_query and ibase_fetch_object. Plus, taking care of some of the date handling.

If I used lower case for the names of the column in mysql, and then when I transfer the php codes to FireBird etc. I will have to go back to make all these lower case column names to upper case in my php codes.

Any quick thoughts from you guys? Thanks!

    You should pick one and choose. I would recommend using lower case, since it's easier to read, and since it's what postgresql folds to (the spec says to fold to upper case, mysql doesn't case fold, while the postgresql chose to purposely go against the spec on this one for the improved readability.)

    Either way, you'd be best off NOT quoting them in yrou app, so if you should port to another database, they will be folded upper or lower, depending on the db, and all you have to do is create the tables in the proper case to begin with.

    Correction for the above. I meant "You should pick one and stick to it." Don't know how it got out as that.

      Definitely lower case for tables and field names as on some filesystems case matters, on others it doesn't and aggro can abound when transferring.

      I always write sql statements with the syntax upper case, and table and field names lowercase and that works for me.

        Write a Reply...