473,770 Members | 7,229 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application Design, <SELECT> Multiple or Single Table?

Hi folks.

I need advice.

2 options, which do you think is the better option to
display/retrieve/report on the data.
Keep in mind reporting (Crystal), SQL Performance, VB Code, usability,
architecture.

Case 1: On a web page I would like to render a dropdown list
<single-select>.
Eg: Yes/No; Monday/Wednesday/Friday/Sunday; Black/Blue/White

Case 2: I need to write a query that's going to list the data with the
element names.

These values have to be stored in a DB and be easily edited.

Option 1: Have a single table with 3 columns, Field_ID, Element_Name,
Element_Value
Eg: work_days, Monday, 1
work_days, Wednesday, 3
case_color, Black, 0000000
case_color, Blue, 0000FF

Stored in 1 table called tbl_dropdown_va lues.
1 Form where you have to select the Form, Field then it's names and
values.

Example query to select values:
SELECT tbl_dropdown_va lues.Element_Na me FROM tbl_days INNER JOIN
tbl_dropdown_va lues ON tbl_days.work_d ay =
tbl_dropdown_va lues.Element_va lue
WHERE tbl_dropdown_va lues.field_ID = 'work_days'
(I could also use a sub select)

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

Option 2: Have a table with 2 columns Element_Name, Element_Value for
each dropdown.
Eg: Monday, 1
Wednesday, 3
Stored in 1 table called tbl_work_days.
1 Form where you enter the name and value.

Black, 0000000
Blue, 0000FF
Stored in 1 table called tbl_case_colors .
1 Form where you enter the name and value.

Example query:
SELECT tbl_work_days.E lement_Name
FROM tbl_days INNER JOIN
tbl_work_days ON tbl_days.work_d ay =
tbl_work_days.E lement_value
Option 1 Pros: 1 Form, 1 Table
Option 1 Cons: Need to know field name when writing queries, queries
more complicated. If fields repeated then I need to add the values to
the table (eg: 3 Yes/No fields)

Option 2 Pros: Multiple forms (no big deal cos forms are autogenerated
from the SQL), Multiple tables
Option 2 Cons: Inverse of the above.

What do you recommend?

My belief is that I should use a combination of the 2. If I've got < 10
values then use a single table if I have > 10 then use a dedicated
table, but then they have to edit values in 2 places.

Thanks folks.

Nov 17 '05 #1
0 2233

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

Similar topics

1
3449
by: Burton Figg | last post by:
I have a SELECT statement which holds a list of times (for adding appointments to a database): e.g. <select name="time" id="time" size="3" multiple> <option value="00:00">00:00</option> <option value="00:30">00:30</option> <option value="01:00">01:00</option> <option value="01:30">01:30</option>
2
4573
by: Mad Scientist Jr | last post by:
I'm trying to get javascipt select all items in a HTML form <SELECT> control and submit the form to an asp.net page. For some reason when the link is clicked, you can see the items all get selected, but then they are somehow unselected as the form posts. Any idea? My Html and ..net code follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD>
7
7898
by: Felix Natter | last post by:
hi, I have a php-Script which gets passed a Boat-ID and this is used to mark an element in a <select> as the default: <select name="boote" multiple="multiple" size="5"> <option value='43'>Aisha</option> <option value='40'>Amsterdam</option> <option value='55'>Asmaa</option> <option value='20'>Beau Rivage</option> <option value='48'>Blue Perl</option>
4
11265
by: headware | last post by:
I have a <select> control that contains many entries. It allows the user to multi-select a group of them, click a button, and store the selected data in a database. Normally they do this starting at the top of the list moving down towards the bottom. The problem I was having was that the <select> control was scrolling back to the top of the page after the postback and the user would lose their place in the <select> control forcing them to...
1
1499
by: Mariusz | last post by:
Hi does anyone know an easy way to define object <select> in that way when clicking on it works as right alt is used. In other words - I need to rebuild select than when I click on first option and then next options (without using right alt) that the first option (and next) is still selected. Of course the second click on selected option deselects it. Or maybe someone of you know how to rebuilt some key (for example "A") to work as...
5
8320
by: Brian Foley | last post by:
Hello, I am used to using the label tag with check boxes and radio buttons in html forms. This allows me to click on the text of the label to activate/deactivate the check box / button, rather than having to click on the (possibly small) box or button. I recently tried to assign a label to a select "drop down list", but found that when I clicked on the label text to bring it into focus, the select box was reset to the first entry. ...
4
2370
by: VK | last post by:
I'm looking for autoexpand <select> list onfocus and collapse it back onselect/onblur (the list is select-one type) I know it is not possible directly, but I've seen here a hack by changing dynamically position static/absolute and sel.size - cannot google it out though. Also some GNU/copyleft widget would be equally great.
5
2472
by: Sonnich | last post by:
Can anyone give me a quick hint for this? Say, I have: <SELECT NAME="opt3" SIZE="15" multiple> Then I'd like to list the items selected... echo $_POST; but this gives only the first one how do I get the rest?
4
39411
by: Man-wai Chang | last post by:
-- iTech Consulting Co., Ltd. Expert of ePOS solutions Website: http://www.itech.com.hk (IE only) Tel: (852)2325 3883 Fax: (852)2325 8288
0
9592
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
9425
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
10230
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
10058
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
10004
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
8886
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...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
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
2817
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.