473,839 Members | 1,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Do's and Don'ts of SQL

Well guys this may be the wrong place but an earlier post by an
"expert" about how a table was poorly designed has piqued my interest.
The question is this. What are the do's and don'ts of sql development?

Please list what you consider to be good and bad practices in general
and/or specific or list links to resources that would be considered
under this topic.

When I consider best practices myself of course there is always the
standards of 3nf and such but what about when it comes to standard
table structures and field sizes for say a Name (first, last, etc) and
contacts table. What about naming conventions and common entities and
structures.

It seems to me that every SQL Developer that enters this field starts
out with the basics of how the technology works and a little of the
practices. Yet from there I see many different directions that they
go.

To start this conversation out let me propose some things that I have
questions about. Feel free to expand and add to this list.

1. What would you consider the standard/best way to represent a
gender.

2. Field Size for Names and address First/Last Etc.

3. Include or don't include City/State in an address/contact list.

4. Structure of a Generic Contact list.

5. Practices for dealing with pictures and documents as well as
related table structures.

6. Level of normalization to aim for. (My minimum is 3 but I
generally hit Boyce Codd myself)

7. What datatypes to avoid and why.

Two requests.
1. Keep it polite.
2. Be constructive and complete.

Jul 23 '05 #1
5 2733
Just as I was posting this I saw a link to a fine articles on the best
practices. Here it is

http://vyaskn.tripod.com/coding_conventions.htm

Jul 23 '05 #2
Want to wait a bit for my next book, SQL PROGRAMMING STYLE to come out?
1. What would you consider the standard/best way to represent a
gender. Use the ISO codes, since they are standards, of course.

2. Field [sic] Size for Names and address First/Last Etc. Use the USPS
model, which is based on a five line, 3.5 inch label with 10 pitch type
on it.

3. Include or don't include City/State in an address/contact list.
Include it since you need it to mail anything.

4. Structure of a Generic Contact list. Unh? That is not a question.
5. Practices for dealing with pictures and documents as well as
related table structures. Use tools intended for them. There are
several good textbases. I have not worked with graphic search tools.

6. Level of normalization to aim for. (My minimum is 3 but I
generally hit Boyce Codd myself) if you use an ORM model instead of
ER, you will get to 5NF.

7. What datatypes to avoid and why. Anything proprietary because it
will not port, cannot be guaranteed to be consistent from one release
to the next, etc.

Jul 23 '05 #3
Well CELKO said me a copy to review and I'll be happy to read it :)
However many people's first target for questions and advise is the
internet and usegroups like this.
This is a resource that we need to continue to support and add to.
Since it is a resouce for all of us. Not just those with a specific
book on their shelf. (not to down play your book which I actually may
go get or look at after it's published) Good luck with the book in the
meantime.

Jul 23 '05 #4
I had a comment on the normalization. We have a reporting database that is
updated nightly. It runs on a little server for only management accesses.
If I normalized this database, reports would run 10 minutes. I normally
build non-normalized tables for the reports and they run in a couple of
seconds. Therefore, my point is normalization really depends on the desired
application.
"Dan Gidman" <da*******@gmai l.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Well guys this may be the wrong place but an earlier post by an
"expert" about how a table was poorly designed has piqued my interest.
The question is this. What are the do's and don'ts of sql development?

Please list what you consider to be good and bad practices in general
and/or specific or list links to resources that would be considered
under this topic.

When I consider best practices myself of course there is always the
standards of 3nf and such but what about when it comes to standard
table structures and field sizes for say a Name (first, last, etc) and
contacts table. What about naming conventions and common entities and
structures.

It seems to me that every SQL Developer that enters this field starts
out with the basics of how the technology works and a little of the
practices. Yet from there I see many different directions that they
go.

To start this conversation out let me propose some things that I have
questions about. Feel free to expand and add to this list.

1. What would you consider the standard/best way to represent a
gender.

2. Field Size for Names and address First/Last Etc.

3. Include or don't include City/State in an address/contact list.

4. Structure of a Generic Contact list.

5. Practices for dealing with pictures and documents as well as
related table structures.

6. Level of normalization to aim for. (My minimum is 3 but I
generally hit Boyce Codd myself)

7. What datatypes to avoid and why.

Two requests.
1. Keep it polite.
2. Be constructive and complete.

Jul 23 '05 #5
>> I normally build non-normalized tables for the reports .. <<

This is a "Data Warehouse" versus "OLTP database"; you can do this only
because the warehouse is loaded from a normalized production database
and then is never updated while in use. A data warehouse is a very
different game. Even teh quereis are different.

Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

61
3402
by: John Baker | last post by:
When declaring an integer, you can specify the size by using int16, int32, or int64, with plain integer being int32. Is integer the accepted default in the programming community? If so, is there a way to remove the ones with size predefined from the autolisting of types when I am declaring something? -- To Email Me, ROT13 My Shown Email Address
0
9855
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9697
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10908
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9426
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7829
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7018
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4487
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.