473,616 Members | 2,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Survey database design

JG
I am a developer and I have a problem trying to design a system to
manage data coming from web surveys. Each section can potentially have
dozens of questions, i.e., fields.
I am focusing here only on the table(s) that will hold the survey data.
I do not have any DDL as I am still trying to understand this!
All the examples I have found so far in books and on the web seem to
deal with fairly limited data, that is easily, or so it looks, broken
down in multiple tables.
It seems that, from my research, having a wide table per survey section
with each field as a column, which has been suggested to me, is not
proper design for many reasons - missing values for non-required
questions, table with 100s of possible columns, etc... - so I played
with the idea of a single table where one of the columns would be the
foreign key pointing to a questions table and another column would hold
the data (this is a simplified explanation.)
The problem with this is that now this column will have to accomodate
all types of data, from bits to large varchars, and that field
validation seems now impossible jeopardizing data integrity.

What do knowledgeable designers come up with in this case? Can someone
point me in the right direction?

Jerry

Aug 25 '05 #1
2 3648
JG (ja****@gmail.c om) writes:
I am a developer and I have a problem trying to design a system to
manage data coming from web surveys. Each section can potentially have
dozens of questions, i.e., fields.
I am focusing here only on the table(s) that will hold the survey data.
I do not have any DDL as I am still trying to understand this!
All the examples I have found so far in books and on the web seem to
deal with fairly limited data, that is easily, or so it looks, broken
down in multiple tables.
It seems that, from my research, having a wide table per survey section
with each field as a column, which has been suggested to me, is not
proper design for many reasons - missing values for non-required
questions, table with 100s of possible columns, etc... - so I played
with the idea of a single table where one of the columns would be the
foreign key pointing to a questions table and another column would hold
the data (this is a simplified explanation.)
Yes, I would very much advocate this design.
The problem with this is that now this column will have to accomodate
all types of data, from bits to large varchars, and that field
validation seems now impossible jeopardizing data integrity.


You could make that column sql_variant. This data type can fit any
other SQL Server data type except text, ntext and image.

In order to prevserve integrity, you can for each question define which
datatype that is correct for that question. In the trigger of the answers
table, you can check with sql_variant_pro perty() that the data type is
correct.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Aug 26 '05 #2
JG
Erland,

thank you very much for your reply.
It is good to know this is the right way!
I didn't know about the sql_variant type so this is really helpful.
In my search I found a site that also seemed to confirm this design.
The interesting thing is they separate the free text answers from the
'pointer' answers (such as radio buttons, drop-downs, etc...), what
they call 'multiple-choice_question s':
http://www.databaseanswers.org/data_...plex/index.htm

Jerry

Aug 30 '05 #3

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

Similar topics

1
5701
by: GTF | last post by:
PHP Web Survey Idea.. I have been given an opportunity to create a web based survey. This is a fairly lengthy survey of 60 pages on paper (various multiple choice and free form). These are the Requirements: -Provide a web interface to a database -Database stores the data (duh), but the capacity to extract the data
0
1570
by: franz | last post by:
Hi developers! Are you using design pattern? And do you want to help me with my research project? Ok – you only need two minutes – I made a little survey form (8 very short questions). There are no mail address or other personal data questioned… Just point your browser to: http://baseportal.com/cgi-bin/baseportal.pl?htx=/krauth/pattern_survey/pattern_survey
35
2494
by: Mason A. Clark | last post by:
I use Opera (the best browser). In Opera I can switch instantly from the page style sheet to my own, which is: TABLE { border: 1px solid red; } TD { border: 1px dotted red; } Ninety-percent of the web pages I see are made much more readable by using my own style sheet. Most web pages use tables. Most web pages are
5
4107
by: DFS | last post by:
I've written several survey systems in which the majority of the questions have the same or similar responses (Yes/No, True/False, scale of 1 - 5, etc). But this latest survey system I'm working on has 8-10 sections, with a variety of question attributes and answer scales. Some items have just a description and require a Yes/No answer, others have a description and an active status and require a Yes/No and price answer, some require a...
4
1483
by: fabiool | last post by:
Hi, We are a systems research group at the Computer Science department at Rutgers University, and are conducting a survey to understand details about network, systems and database administration. We hope that this information would help us recreate a realistic environment to help research in 'systems management'. We request network, systems, and database administrators to take this
3
6325
by: Yurk Yurk | last post by:
I need to create a database or something that will allow me to input all of the results of a survey and then search the results for trends and stuff. For example, it might have questions like: 1. Your age: , , , 2. Gender: , 3. Children ages (select as many as apply): , , 4. Check as many of these as you like: The sky should be purple It rains too much
12
1849
by: pietlinden | last post by:
Hi, sorry for the vague subject. I am working for a company that finds respondents for surveys and then sends the respondent list and the survey to another company to perform the actual surveys. In the past, they have used Excel for this and, as you can imagine, the results are a nightmare to work with because the resulting data is inconsistent and denormalized. I'm looking at Duane Hookum's At Your Survey and found his posts on how...
0
1486
by: Joerg Rech | last post by:
Dear software practitioners, consultants, and researchers, we are currently conducting an international survey about architecture and design patterns. Our goal is to discover how familiar people are with these patterns (and anti-patterns) as well as to elicit the information need, the usage behavior, and the experience of software organizations regarding architecture patterns and design patterns.
0
1601
by: Joerg Rech | last post by:
Dear software practitioners, consultants, and researchers, we are currently conducting an international survey about architecture and design patterns. Our goal is to discover how familiar people are with these patterns (and anti-patterns) as well as to elicit the information need, the usage behavior, and the experience of software organizations regarding architecture patterns and design patterns. Therefore, we would like to invite you...
0
8146
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
8592
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8297
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5550
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
4141
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2579
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
1
1759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1445
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.