A buddy explained which i will include the table title within the area title of the identical table, and I am wondering why? And if it is such as this? Example:

(Table) Users  
(Fields) user_id, username, password, last_login_time

I observe that the prefix 'user_' is meaningless since i have know it's already for any user. But Let me know what you think too. note: I am programming in php, mysql.

pointless to incorporate the table title, it's unnecessary. Within the queries you are able to make reference to the fields as <table title>.<field title> anyway (eg. "user.id").

With generic fields like 'id' and 'name', it is good to place the table title in.

This is because it may be confusing when writing joins across multiple tables.

It's personal preference, really, but that's the reasoning behind it (and that i always get it done by doing this).

Whatever method you select, make certain it's consistent inside the project.

To be sure along with you. The only real place I'm enticed to place the table title or perhaps a reduced type of it's on primary and foreign secrets or maybe the "natural" title is really a keyword.

Users: id or user_id, username, password, last_login_time
Post: id or post_id, user_id, post_date, content

I generally use 'id' because the primary key area title however in this situation I believe user_id and publish_id are perfectly Perfectly acceptable. Observe that the publish date was known as 'post_date" because 'date' is really a keyword.

A minimum of that's my convention. Your mileage can vary.

Personally I do not add table names for area names within the primary table however when utilizing it like a foreign area in another table, I'll prefix it using the title from the source table. e.g. The id area around the customers table is going to be known as id, but around the comments table it, where surveys are from the user who published them, it will likely be user_id.

I acquired from CakePHP's naming plan and i believe it's pretty neat.

Prefixing the column title using the table title is really a method of ensuring unique column names, making joining simpler.

But it's a tedious practice, particularly if whenever we have lengthy table names. It's generally simpler to simply use aliases when appropriate. Besides, it does not help if we are self-joining.

Like a data modeller I actually do fight to remain consistent constantly. With ID posts I theoretically would rather have just ID however i usually find I've tables with posts known as USER_ID, ORDER_ID, etc.

You will find situations where it may be positively advantageous to utilize a common column title across multiple tables. For example, whenever a logical super-type/sub-type relationship continues to be made as only the child tables it's helpful to support the super-type's column on all of the sub-type tables (e.g. ITEM_STATUS) rather than renaming it for every sub-type (ORDER_ITEM_STATUS, INVOICE_ITEM_STATUS, etc). Many of the true when they're enums having a common group of values.

For instance, your database has tables which store details about Sales and Hr departments, you can title all of your tables associated with Sales department as proven below:

SL_NewLeads SL_Areas SL_TerritoriesManagers

You can title all of your tables associated with Human assets department as proven below:

HR_Candidates HR_PremierInstitutes HR_InterviewSchedules

This type of naming convention ensures, all of the related tables are arranged together whenever you list all of your tables from a to z. However, in case your database handles just one logical number of tables, you do not need to make use of this naming convention.

Observe that, sometimes you finish up up and down partitioning tables into several tables, though these partitions effectively represent exactly the same entity. Within this situation, append a thing that best identifies the partition, towards the entity title

Seems like the final outcome is: When the area title is exclusive across tables - prefix with table title. When the area title has got the possibility to be copied in other tables, title it unique.

I discovered area names for example "img, address, phone, year" since different tables can include different images, addresses, telephone numbers, and years.