Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 21st, 2005, 12:25 PM
csdstudent csdstudent is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 36 csdstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 11 sec
Reputation Power: 5
Beyond normalization forms

Hello.

I’m stuck on the following problem. Let’s imagine you want to create a DB where you can’t have a clear data specification. For example the following table

===================

#Building ID | Location

===================

And your customer has the great idea to add a not foreseeable column called GPS Infrared Satellite Control string (Who could have thought of that!!!)



===============================================

#Building ID | Location | GPS Infrared Satellite Control String

===============================================


Fine, BUT there can be NOBODY who can change the Database. You see or customer has many such bright ideas, and we can afford to change the database every time based on his new ideas, but either can we make him to give us an exact data definition or tell him to keep his ideas for himself.


WHAT TO DO NOW?

The key to solve this problem is to change the database only by inserting new rows into predefined normalized tables.

Any idea how to approach such a solution, or where to begin start looking for something like that?

As said, Normalization Forms can’t deal with this form of unforeseeable data.

Thanks for your time reading this.

Reply With Quote
  #2  
Old February 22nd, 2005, 04:11 AM
Dumbo Dumbo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 29 Dumbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 27 m 31 sec
Reputation Power: 0
I'm not quite sure I understand your problem... but here it goes.

I gather you have a table Building with an id and several predefined columns.
Now you have a customer who wants to add new columns and you can't handle that in your code...
(wich sugests to me you're using * instead of columnames in select and insert statements)
What you could do is define a table with the names of the extra fields your contractor wants and then define a table that has a foreign key to the building table and a foreign key to the fields table that holds all the extra values
eg
CREATE TABLE Buiding(
buildId INTEGER NOT NULL IDENTITY(1,1)
, buildLocation VARCHAR(100))

CREATE TABLE ExtraFields(
fieldId INTEGER NOT NULL IDENTITY(1,1)
, fieldName VARCHAR(100))

CREATE TABLE BuidingFieldValues(
bfvId INTEGER NOT NULL IDENTITY(1,1)
, fieldId INTEGER NOT NULL
, buildId INTEGER NOT NULL
, bfvValue VARCHAR(100))

extra fields would then have a record say with fieldId=1 and fieldName='GPS Infrared Satellite Control String'
and in buildingFieldValues you can store records with fieldId=1, buildId=1 and bfvValue='whatever' and fieldId=1, buildId=2 and bfvValue='whatever else'

This alows you to create a standard application and then tailer it to a specific clients whishes

Hope this helps

Reply With Quote
  #3  
Old February 23rd, 2005, 10:50 AM
csdstudent csdstudent is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 36 csdstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 11 sec
Reputation Power: 5
Thanks for your reply.

I thought the same way like you, but found the following disadvantages. Let’s keep our example and your suggestions.

Table Buildings
===================
#BuildingID | Location
===================

Table ExtraFields
===================
#fieldID | fieldname
===================

Table BuildingsFieldsValues
=======================
#fieldID,#BuildingID,bfvValue
=======================

As we can see our tables are in 3NF, but taking a closer look at the table BuildingsFieldsValue we have a MVD (multi-valued dependency) so to solve the table for 4NF we split the BuildingsFieldsValue in three tables lets say:

BuildingsFieldsValues1
#fieldID,#BuildingID

BuildingsFieldsValues2
#fieldID,#bfvValue

BuildingsFieldsValues3
#BuildingID,bfvValue

Theoretically everything should be fine now, but splitting our primary key #BuildingID & #fieldID created unspecified values. Which means now we can’t have queries that give us the desired value for a specific fieldID and BuildingID.

At this point, excuse me for writing a whole story, but I think it’s necessary.

So we forget about 4NF, which brings the following problems

Our table BuildingsFieldsValue would have data like

BuildingID fieldID bvfValue

1 ------- 1 ----12,4

1 ------- 3 ----Wall street

1 ------- 4 ----GPS Infrared Satellite Control String

2 ------- 1 ----15,4

2 ------- 3 ----Park street



And so on. We are wasting disk space for repeating all the time the Building ID (but who cares with GB of available disk-space). The main problem is that the database has tables with an average row number of 2.500.000-2.700.000. Searching the BuildingID column and the fieldID column means approximately doubled processing time, when having unsorted columns which will be the fact.

This can be a problem; because the database is online available and high user traffic is expected so update, select and insert queries will take more time when using the above solution.

Using log tables, which save the incoming traffic can make things better, but it takes time the server to update this tables and also it can be that there is no idle-time on the server for such processes. Having a separate server for this task can solve things but SERVER = $$$MONEY$$$.

Any idea how to solve the above described problem with the tables, or where to start looking for a log-table solution? Some related articles or books would be also very useful.

That was all; I hope it was interesting to read.

Thanks for your time.

Reply With Quote
  #4  
Old February 23rd, 2005, 10:58 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
The real solution to your dilema is to have clear and concise application requirements before any code, etc... is started.

Reply With Quote
  #5  
Old February 23rd, 2005, 12:04 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Quote:
Originally Posted by Memnoch
The real solution to your dilema is to have clear and concise application requirements before any code, etc... is started.



Without this you next best option is to have Generic blank fields (in most tables), where the Customers can populate anything they want in them, but can't really perform any searchs against them, unless they want to pay for customized programming.

Yes if takes up more HD space, but "with GB of available disk-space"

S-
__________________
If you have found a particular post helpful, show your appreciation by adding reputation points to that user by clicking the "scales" image in the upper right had corner of their post.

Reply With Quote
  #6  
Old February 23rd, 2005, 05:36 PM
csdstudent csdstudent is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 36 csdstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 11 sec
Reputation Power: 5
Thanks for your interest.

As said before in the post, we can’t have “concise application requirements” and customized programming. The goal is a fully-customizable and stand-alone database, with a satisfactory performance as described in the above post. Any idea for a good google search?

Reply With Quote
  #7  
Old February 23rd, 2005, 06:06 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
"Concise Application Requirements" is exactly what any well developed/designed application should have.

Requirements define the Who/What/When/Where and How of an application.
They should be clear and concise.

Reply With Quote
  #8  
Old February 23rd, 2005, 06:59 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Quote:
Originally Posted by csdstudent
Thanks for your interest.

As said before in the post, we can’t have “concise application requirements” and customized programming. The goal is a fully-customizable and stand-alone database, with a satisfactory performance as described in the above post. Any idea for a good google search?



Reality, It isn't going to happen with out a ton of coding and then your performance is going to go down, and then you actually lose the flexibility you are trying to gain (system becomes code dependent instead of data dependent).

Give them some extra dummy fields in each table and leave it at that.

Good Luck

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Beyond normalization forms


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT