Welcome Guest, Not a member yet? Register   Sign In
Table Structure
#8

[eluser]Narkboy[/eluser]
Generally, I try to start field names with the table name.

Basically - it prevents problems when you're joining several fields with 'id'. It also stops a load of hassle debugging.

You can end up with very long field names, which can be an issue - especially since I name my tables in a related way:

product
product_audit
product_update
product_update_result

Poor example, but you get the idea.

I think the worst name I've managed to create is:
ct_product_update_result.result_image_outcome

Which is an error field for importing product images from a remote server. You suffer a little from typing extra when writing queries etc, but for my money it's still easier than spending hours to discover that you've ordered things wrong because 'id' != 'id' != 'id'.

Smile

***Edit***

By all means use short forms as long as they are understandable:

product => prod
message => msg
user => usr

Always stick to the same convention.

Also, try to make sure that the field name is meaningful - message_message is not as good as message_body or message_content. msg_body or msg_content are equally as good

Avoid 'date' - date of what? Use 'date_created', 'date_updated', 'date_submitted' - it's not unusual for me to have 2 or more dates in a table.


Messages In This Thread
Table Structure - by El Forum - 11-22-2010, 06:59 PM
Table Structure - by El Forum - 11-22-2010, 08:30 PM
Table Structure - by El Forum - 11-22-2010, 09:10 PM
Table Structure - by El Forum - 11-22-2010, 09:17 PM
Table Structure - by El Forum - 11-22-2010, 10:11 PM
Table Structure - by El Forum - 11-22-2010, 11:39 PM
Table Structure - by El Forum - 11-23-2010, 02:23 AM
Table Structure - by El Forum - 11-23-2010, 05:32 AM
Table Structure - by El Forum - 11-23-2010, 05:41 AM
Table Structure - by El Forum - 11-23-2010, 05:51 AM
Table Structure - by El Forum - 11-23-2010, 06:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB