all groups > sql server programming > january 2006 >
You're in the

sql server programming

group:

Too many fields in one table ??


RE: Too many fields in one table ?? ML
1/2/2006 7:22:03 AM
sql server programming:
Don't simply create tables - design a solution.

First of all, get a good understanding of the issue at hand. What ever it
is, you need to understand the basic principles of the business logic.

Identify individual informational entities (subjects, objects, properties),
identify similarities between the entities.

Identify how the entities are related to each-other.

In your specific case you could start by analyzing what you *actually have*,
then try to reverse-engineer what you *really should have*.

Unfortunatelly data modelling cannot be learned in news groups. We can,
however, help you get a good start at it. Maybe you can post the table DDL
and in a few words explain the business requirement behind your current
design.


ML

---
RE: Too many fields in one table ?? Mark Williams
1/2/2006 8:32:04 AM
A couple of good resources that I have referenced are

http://www.utexas.edu/its/windows/database/datamodeling/rm/rm7.html

(which looks like the work of C.J. Date)

and

http://en.wikipedia.org/wiki/Database_normalization

An un-normalized database is typically easy to get information out of (a
single SELECT statement with no joins), but very difficult to put information
into or to update information (lots of UPDATES or INSERTS just to change
information about a single thing). A normalized database is harder to get
information out of (joins), but much easier to update in a consistent way.

A good place to start is building a prepositional statement about the things
you wish to describe in your relation (table). For example, if I wanted to
build a relation describing my friends, I'd state with this statement:

A have a friend, with the name ___________, is ______ years old, and has
friends for me for ______ years.

The statement should avoid repeating conditions that could not apply to all
friends, like

and they did this ______________ and this _________ and this __________

--



[quoted text, click to view]
Re: Too many fields in one table ?? Tom Moreau
1/2/2006 9:25:37 AM
Usually, a high number of columns indicates poor normalization. Also, if
80% are nvarchar(50), that says that no thought was put into the datatypes.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com

[quoted text, click to view]
one of my tables got around 160-200 fields, 80%of them are nvarchar(50)
Some said it is very poor design for the table /
Does any doc/specificatoin can let me know "a better way to design table "??
Thanks a lot


Re: Too many fields in one table ?? --CELKO--
1/2/2006 4:46:17 PM
[quoted text, click to view]

In 20+ years of SQL programming, I have never seen a table that wide.
I am told that some medical research problems can have that many
attributes. But add the fact that most of the columns (NOT fields!!
totally different!! ) are a "magic number" in the most general data
type in the dialect. This leads me to believe that your design sucks.
Big.

Since your design is probably screwed up beyond belief, you will need
to a course or book on **BASIC** data model and schema design -- not a
newsgroup posting or two.

I (of course) will push my DATA & DATABASES and then a copy of SQL
PROGRAMMING STYLE. But any book will help.
Too many fields in one table ?? Agnes
1/2/2006 10:16:15 PM
one of my tables got around 160-200 fields, 80%of them are nvarchar(50)
Some said it is very poor design for the table /
Does any doc/specificatoin can let me know "a better way to design table "??
Thanks a lot

Re: Too many fields in one table ?? Erland Sommarskog
1/2/2006 11:09:55 PM
Agnes (agnes@dynamictech.com.hk) writes:
[quoted text, click to view]

It certainly smells like a case of a bad design, but a very common
answer to database question is "it depends". So without further knowledge,
it is difficult to say for user.

But if it would happen to be the case that you have columns named:
abcline1, abcline2, ... abcline15, xyzline1, xyzline2, ... xyzline23
then there certainly is reason to redesign this, so that there are
subtables abclines and xyzlines with primary keys consisting of
the PK of the parent table, and the line number that now is in the column
name.

I mention this, as this is a quite common misdesign; I suspect often
carried over from non-relational data stores such as flat files.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
AddThis Social Bookmark Button