Search Postgresql Archives

Table and Field namestyle best practices?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm new to pgsql, mostly coming from MSSQL. It sounds like it's simplest to
keep field names lowercase with pgsql, so I will have to change some habits
I've developed over the years. I would like to glean whatever collective
wisdom I can here from experienced pgsql devs.

I've been using namestyles with mixed case like OrgID. That is much more
readable than orgid. Probably a good convention to adopt would be to use
namestyles like org_id. That change I can live with.

But another issue is the way that I've been naming foreign key references. I
tend to prefix field names with a table based acronym. So names like
OrgName, OrgCity. Foreign key fields incorporate the ref'd pk. So, if I have
a table tblEmployee, fk to the org table would be like EmpOrgID. I know many
would simply use OrgID as the fk in tblEmployee, but I have liked
compounding the names because is results in completely unambiguous field
names throughout the db. If I'm giving up the mixed case naming, I could use
emp_fname, emp_lname, emp_org_id, but I'm not sure if that's best.

I am very curious to hear the various conventions folks here have arrived
at. I don't expect there to be consensus, but the various rationales might
help me arrive at an approach that works well for me.
-- 
View this message in context: http://www.nabble.com/Table-and-Field-namestyle-best-practices--tf2596761.html#a7243332
Sent from the PostgreSQL - general mailing list archive at Nabble.com.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux