473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Multiple attribute design that need to be searchable

Hello,

I'm doing a school project and I'm supposed to be able to track campgrounds
and their amenities. Here is some of the information I'm supposed to store:

CAMPGROUND
Number of Sites Number
Summer Season End Date
Summer Season Start Date
Reservations Accepted Y/N
Firewood Rate Number
Quiet Hours Text
15 Amp Service Y/N
30 Amp Service Y/N
50 Amp Service Y/N
Cable/Satellite Hookup Y/N
Fire Pits Y/N
Flush Toilets Y/N
Free Parking Y/N
Handicap Access Y/N
Hot Showers Y/N
and so on and so on (there are quite a few amenities that I'm supposed to
track)

Now, the first thing I was thinking of was to store all of this in one table
and for each amenity they have, the value would be true, while the ones they
had would be false. Now, the problem with storing these attributes in the
same table means that I cannot add a "description", or a note with
additional information from the owner about the amenities, or even an image
if we'd like that displayed instead of the text. The way that I thought of
having that was to add the amenities, facilities, and restrictions (anything
that has a Y/N value above) into a "Features" table, then join a feature to
a campground with a CampgroundFeatureDetail table (then we could also group
the features by amenities, facilities, hookups, restrictions, etc. by adding
the CampgroundFeatureType table). This way, if a campground has a certain
amenity, then it will exist in the CampgroundFeatureDetail table with the
CampgroundID. This would also mean that by not entering each feature
manually into the campground table, it is much easier to add a new feature.
The data access layer won't need to be changed, as well as the HTML as the
data displayed would be dynamic.

The problem that I found with this technique is that if someone is using the
search form and tries to search for a site with multiple amenities (they
want a campsite with a Free Parking, Handicap Access, Hot Showers, Internet
Access, Paved Pads, Paved Roads, and that allows Pets, for example), then
the only way to find a campground that meets those requirements is if an
entry exists in the details table for that location. That produces a search
like this:

SELECT CampgroundID, NumberOfSites, etc...
FROM Campground
WHERE CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'F71881BF-E835-4117-AAB1-DE2619D493V')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'08D00648-D842-43DF-A238-A591FF14B044')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'9D9JF439-F2SD-F2V9-9N6G-G5F4F65L9KJ8')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'9L0HK43D-FJ39-90FD-LD90-FKJ342JKL98UJ')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'82LKJ342L-JK32-FD34-DF34-MJK9823JKN34')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'NM23442-FHD4-FDJ3-AS21-SAER532SAD34')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'JK324320-FDS3-FKL2-A348-DF23ZX43DF345')
....and so on for every feature they are searching for.

Now, what I'm concerned about is that this may make for a very slow search
if there are thousands of entries to search through because of the multiple
queries. I have a feeling that this may be a bad design. Does anyone know
of a better way of doing this?

Thanks,

Kevin


Jul 9 '08 #1
1 1310
This has been answered in microsoft.public.sqlserver.programming.
Please don't cross post independent messages. If you must post to
more than one group put BOTH group names on a single message.

Roy Harvey
Beacon Falls, CT

On Wed, 9 Jul 2008 10:49:27 -0600, "Kevin" <de*********@hotmail.com>
wrote:
>Hello,

I'm doing a school project and I'm supposed to be able to track campgrounds
and their amenities. Here is some of the information I'm supposed to store:

CAMPGROUND
Number of Sites Number
Summer Season End Date
Summer Season Start Date
Reservations Accepted Y/N
Firewood Rate Number
Quiet Hours Text
15 Amp Service Y/N
30 Amp Service Y/N
50 Amp Service Y/N
Cable/Satellite Hookup Y/N
Fire Pits Y/N
Flush Toilets Y/N
Free Parking Y/N
Handicap Access Y/N
Hot Showers Y/N
and so on and so on (there are quite a few amenities that I'm supposed to
track)

Now, the first thing I was thinking of was to store all of this in one table
and for each amenity they have, the value would be true, while the ones they
had would be false. Now, the problem with storing these attributes in the
same table means that I cannot add a "description", or a note with
additional information from the owner about the amenities, or even an image
if we'd like that displayed instead of the text. The way that I thought of
having that was to add the amenities, facilities, and restrictions (anything
that has a Y/N value above) into a "Features" table, then join a feature to
a campground with a CampgroundFeatureDetail table (then we could also group
the features by amenities, facilities, hookups, restrictions, etc. by adding
the CampgroundFeatureType table). This way, if a campground has a certain
amenity, then it will exist in the CampgroundFeatureDetail table with the
CampgroundID. This would also mean that by not entering each feature
manually into the campground table, it is much easier to add a new feature.
The data access layer won't need to be changed, as well as the HTML as the
data displayed would be dynamic.

The problem that I found with this technique is that if someone is using the
search form and tries to search for a site with multiple amenities (they
want a campsite with a Free Parking, Handicap Access, Hot Showers, Internet
Access, Paved Pads, Paved Roads, and that allows Pets, for example), then
the only way to find a campground that meets those requirements is if an
entry exists in the details table for that location. That produces a search
like this:

SELECT CampgroundID, NumberOfSites, etc...
FROM Campground
WHERE CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'F71881BF-E835-4117-AAB1-DE2619D493V')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'08D00648-D842-43DF-A238-A591FF14B044')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'9D9JF439-F2SD-F2V9-9N6G-G5F4F65L9KJ8')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'9L0HK43D-FJ39-90FD-LD90-FKJ342JKL98UJ')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'82LKJ342L-JK32-FD34-DF34-MJK9823JKN34')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'NM23442-FHD4-FDJ3-AS21-SAER532SAD34')
AND CampgroundID in (SELECT CampgroundFeatureDetailCampgroundID FROM
CampgroundFeatureDetail Where CampgroundFeatureDetailCampgroundFeatureID =
'JK324320-FDS3-FKL2-A348-DF23ZX43DF345')
...and so on for every feature they are searching for.

Now, what I'm concerned about is that this may make for a very slow search
if there are thousands of entries to search through because of the multiple
queries. I have a feeling that this may be a bad design. Does anyone know
of a better way of doing this?

Thanks,

Kevin
Jul 9 '08 #2

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

Similar topics

3
by: Fred | last post by:
I have a query that returns multiple identical records, however it should only return one. Indeed there is only one record for the OrderActionTypecode of 'P' yet there are two orderactions so it...
0
by: agrawal_rajesh | last post by:
Its interesting to know that We can create multiple interfaces in a single class in visiual studio 6.0 ATL. But I am surprised to see that we can't create the same in Visual studio .Net. In .Net...
11
by: charlie_M | last post by:
I have a number of applications where I want to have many onclick='submit()' attached to different 'elements' on a single form ..... which sends the form to a CGI "script" which does all the...
20
by: km | last post by:
Hi all, In the following code why am i not able to access class A's object attribute - 'a' ? I wishto extent class D with all the attributes of its base classes. how do i do that ? thanks in...
4
by: anonymous | last post by:
When I use the schema collection to apply many schemas to one XML instance document, I get an error if I do not qualify every element with the appropriate namespace. Both the W3C site and this...
19
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a...
1
by: EricV | last post by:
I have been looking for a solution to the following problem: I have a databases with multiple searchable fields, and what I want to do is to design a query which will enable me to enter various...
1
by: natwong | last post by:
Hi All, I'm hoping that someone could help me out since I'm new with Access. Background: Database was set up as a simple data entry and reporting tool for Program Initiatives. The data...
0
by: Kevin | last post by:
Hello, I'm doing a school project and I'm supposed to be able to track campgrounds and their amenities. Here is some of the information I'm supposed to store: CAMPGROUND Number of Sites ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.