<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx</link><description>Database Naming Conventions Version 1.1 Last Revised May 13, 2004 by Jason Mauss The main goal of adopting a naming convention for database objects is so that you and others can easily identify the type and purpose of all objects contained in the database</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#7247329</link><pubDate>Wed, 04 Nov 2009 22:41:28 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7247329</guid><dc:creator>cng</dc:creator><author>cng</author><description>&lt;p&gt;I ran across your blog when trying to find database table naming conventions. Thanks for putting pieces together. Good works!&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7247329" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#7107518</link><pubDate>Wed, 03 Jun 2009 23:11:03 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7107518</guid><dc:creator>Jerome</dc:creator><author>Jerome</author><description>&lt;p&gt;Nooooooooooooo. Database design 101 - table names absolutely should not ever, never be plural. It's a cheap and nasty practice and makes you look like a chump who doesn't take database design seriously.&lt;/p&gt;
&lt;p&gt;If you end up with a Customers table that only has one record in it, do you rename it to Customer then? So you have a Baskets table and a Products table... is the detail table called BasketsProducts? Arrrggg, horrid! :)&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7107518" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#7058758</link><pubDate>Thu, 23 Apr 2009 23:44:55 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7058758</guid><dc:creator>Douglas Swehla</dc:creator><author>Douglas Swehla</author><description>&lt;p&gt;@VM&lt;/p&gt;
&lt;p&gt;Examples given in the Oracle resource linked below use plural table names. The copyright is 1996, 2005.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements008.htm"&gt;download.oracle.com/.../sql_elements008.htm&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7058758" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#7035974</link><pubDate>Wed, 08 Apr 2009 18:34:20 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7035974</guid><dc:creator>VM</dc:creator><author>VM</author><description>&lt;p&gt;Stating that &amp;quot;tables are logical collections of one or more entities as records&amp;quot; contradicts the foremost rule of the conceptual and logical design (is the author aware of those??):&lt;/p&gt;
&lt;p&gt;- a table represents an entity.&lt;/p&gt;
&lt;p&gt;IT HAS BEEN A STANDARD FOR ALMOST ALL RDBMS FOR THE LAST 20 YEARS, INCLUDING ORACLE AND SQL SERVER THAT A TABLE NAME MUST BE IN SiNGULAR.&lt;/p&gt;
&lt;p&gt;Update your knowledge.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7035974" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#7020587</link><pubDate>Wed, 01 Apr 2009 15:55:48 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7020587</guid><dc:creator>James Hargreaves</dc:creator><author>James Hargreaves</author><description>&lt;p&gt;Interesting stuff!&lt;/p&gt;
&lt;p&gt;I am not currently following a convention per se, but I intend to do so in the future.&lt;/p&gt;
&lt;p&gt;I have always favoured pluralised table names, but I may switch to singular names in the future, as they seem like the way forward to me. For instance, my take on the project/activity example above would be:&lt;/p&gt;
&lt;p&gt;CREATE TABLE project (&lt;/p&gt;
&lt;p&gt; &amp;nbsp;id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,&lt;/p&gt;
&lt;p&gt; &amp;nbsp;name VARCHAR(100),&lt;/p&gt;
&lt;p&gt;);&lt;/p&gt;
&lt;p&gt;CREATE TABLE activity (&lt;/p&gt;
&lt;p&gt; &amp;nbsp;id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,&lt;/p&gt;
&lt;p&gt; &amp;nbsp;name VARCHAR(100),&lt;/p&gt;
&lt;p&gt; &amp;nbsp;project_id INT NOT NULL,&lt;/p&gt;
&lt;p&gt;);&lt;/p&gt;
&lt;p&gt;So activity.project_id is a foreign key to project.id and your join would look something like:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; SELECT project.name, activity.name&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; FROM project&lt;/p&gt;
&lt;p&gt;LEFT JOIN activity&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ON project.id = project_id&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;WHERE project.name = &amp;quot;world domination&amp;quot;;&lt;/p&gt;
&lt;p&gt;Which I think looks quite neat, with the possible exception of the RHS of the ON clause, which should probably be activity.project_id :)&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7020587" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#6956425</link><pubDate>Thu, 12 Mar 2009 12:55:17 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6956425</guid><dc:creator>...</dc:creator><author>...</author><description>&lt;p&gt;Gute Arbeit hier! Gute Inhalte.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6956425" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#6938144</link><pubDate>Thu, 05 Mar 2009 12:43:52 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6938144</guid><dc:creator>...</dc:creator><author>...</author><description>&lt;p&gt;Interessante Informationen.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6938144" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#6930919</link><pubDate>Fri, 27 Feb 2009 14:27:48 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6930919</guid><dc:creator>Sebastian</dc:creator><author>Sebastian</author><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Very interesting post &amp;amp; debate.&lt;/p&gt;
&lt;p&gt;I agree to some of the rules and disagree about others. But in the end this is normal, there are lots of constraints and variables playing.&lt;/p&gt;
&lt;p&gt;I'm not developing on .NET at this moment but i did, and i think it is interesting to make the db naming convention technology-independent, so i think it is important to not mix db naming with coding preferences.&lt;/p&gt;
&lt;p&gt;Some points:&lt;/p&gt;
&lt;p&gt;I used to pluralize table names according to what has been said here: Tables are the relational synonymous of oop's collections. But after facing the above mentioned problems i am making some concessions.&lt;/p&gt;
&lt;p&gt;I disagree about the PascalCase notation, i like it and i use it in my code but i think it is not necessary to use it on the db. If you use an ORM framework, it eliminate the problem by creating a translation layer. You can still have a UserRole class but your table can be named actually user_role. I think it is highly recomended to use them whenever it is possible.&lt;/p&gt;
&lt;p&gt;I had problems with UpperCases on some servers and now i think it is better to despense with them.&lt;/p&gt;
&lt;p&gt;Of course, if you are going to have heavy Stored Procedures you will have a lot of code in your db but i think an ORMs and a good data access layer helps a lot.&lt;/p&gt;
&lt;p&gt;Also i used to build up my junction tables names by joining the related tables names, but sometimes this aproach has the disadvantage of the neverending table names, so i am not sure about this but sometimes i try to find i meaningful name for the relation, for example: if i have a pair of car &amp;amp; car_identifier tables i prefer to name the junction table car_identification rather than car_car_identifier. Also i think it is always needed two have different symbols to distinguish between tables names and table name individual words (using PascalCase naming or not). &lt;/p&gt;
&lt;p&gt;In the example above, using PascalCase naming you would name it: CarCarIdentifier, what i think it is not clear. If you use lower case &amp;amp; underscores the result would be: car_car_identifier wich isn't clear either. So i use a double underscore to separate table names from individual words: car__car_identifier. I know, this may look awful :), but i think in a priority order it is first the compatibility with external conditions, and i did not like when i had to change all my PascalCase named table &amp;amp; fields to lowercase because of some technical constraints.&lt;/p&gt;
&lt;p&gt;So now, and for me: database &amp;amp; code are different things and i don't look for beauty in the db. I give priority to compatibility and order. It is only my point of view.&lt;/p&gt;
&lt;p&gt;I find very useful this post and encourage everybody to build a stronger convention.&lt;/p&gt;
&lt;p&gt;Great job.&lt;/p&gt;
&lt;p&gt;Sebastian.&lt;/p&gt;
&lt;p&gt;PS: Sorry for my poor english.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6930919" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#6735132</link><pubDate>Fri, 14 Nov 2008 13:45:43 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6735132</guid><dc:creator>SA</dc:creator><author>SA</author><description>&lt;p&gt;Hi, Why do you advice againt prefixing column names with the datatype ie intNumber och strName ?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6735132" width="1" height="1"&gt;</description></item><item><title>re: DevCampus Database Naming Conventions</title><link>http://weblogs.asp.net/jamauss/pages/DatabaseNamingConventions.aspx#6291505</link><pubDate>Wed, 18 Jun 2008 16:44:04 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:6291505</guid><dc:creator>Mark Brady</dc:creator><author>Mark Brady</author><description>&lt;p&gt;@ Tariq:&lt;/p&gt;
&lt;p&gt;An HR/Payroll app? Really? that hasn&amp;#39;t been done to death?&lt;/p&gt;
&lt;p&gt;ff_mac said &amp;quot;Using tablenameID for both FK and PK gets rid of the name collision of the ID field but means that you can’t easily find FK references separate from PK references.&amp;quot;&lt;/p&gt;
&lt;p&gt;Huh? you have no constraint table to query that defines PKs and FKs. No it&amp;#39;s not hard to tell the difference in any real RDBMS. What is hard is to find missing constraints left by sloppy developers when the column changes name from table to table.&lt;/p&gt;
&lt;p&gt;Plural table names: I can always tell the people who never script changes to their databases. If you have a COMPANIES table is the ID column Companies_ID? That makes no sense. When you start to write code that builds code, you&amp;#39;ll want this to be very, very regular. &lt;/p&gt;
&lt;p&gt;%table_name% = Name of the table. &lt;/p&gt;
&lt;p&gt;%table_name%_ID = Name of the PK Column&lt;/p&gt;
&lt;p&gt;%table_name%_PK = Name of the PK Constraint.&lt;/p&gt;
&lt;p&gt;If I had to guess at plurals it would make this process much more difficult.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6291505" width="1" height="1"&gt;</description></item></channel></rss>