views:

333

answers:

5

I work at a company that has some very non-standardized SQL conventions (They were written by Delphi Developers years ago). Where is the best place that I can find SQL industry standard convention definitions that are most commonly used?

+6  A: 
  1. there aren't any
  2. it there were, they'd be obsolete
  3. if they're not obsolete, you won't like them
  4. if you like them, they're insufficient
  5. if they're sufficient, no one else will like them

seriously, strive for readability, i.e. use meaningful field and table names; nothing else is really necessary

(ok some common prefixes like usp and udf and udt may be useful, but not required)

Steven A. Lowe
#2 - like SQL-92 joins? =)
StingyJack
See, starts right off with a zinger. Needs an "argumentative" tag (kidding).
le dorfier
Funny, but true. I can honestly say there are no "enterprisey" ways to name tables, columns, stored procedures or functions. As far as syntax, the same applies. I'm guilty of old style joins (i.e. a.id = b.id or b.id is null), but that really comes down to readability.
Abyss Knight
+3  A: 

This is the best one I've ever seen... Naming Conventions

However, standards should really be all about clarity, simplicity, and ease of adoption among your team.

There shouldn't be a bunch of incredibly strict naming guidelines, it should focus on style. The point is not to torment developers, it is to create a congruent style throughout the system so that it is easy to move from one section to another.

chills42
+2  A: 

There are no exact industry-wide SQL standards. The best option is to google for SQL standards because several knowlegable people have posted some rather good, extensive, and complete documents on the subject. Read through them and absorb the items that apply to your environment.

NYSystemsAnalyst
+6  A: 

In his book "SQL Programming Style," Joe Celko suggests a number of conventions, for example that a collection (e.g. a table) should be named in the plural, while a scalar data element (e.g. a column) should be named in the singular.

He cites ISO-11179-4 as a standard for metadata naming, which supports this guideline.

Bill Karwin
This has always seemed to make the most sense even when i designed my very first database. I also adopted Suffixing any foreign key field with ID.
Martijn Laarman
+1  A: 

Here you can find a lot of Rules to better SQL /SQL Server.
Yes, it's the company that I am working for, but they are good! And these rules come from experience with client projects.

Have a look and take what you like!

Peter Gfader