473,466 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

one SET vs. many BIT (TINYINT)? pros/cons?

I have a database that stores text (and other objects) which I would like to
categorize under multiple categories. I started out creating a "SET" field
with the different category names and I imagined being able to retrieve them
via matching on one or more categories and having this field indexed.

Or, I could also add a BIT (which I understand right now is the same as
TINYINT) field for each category and then assign 0 to rows that don't fit
that category and 1's to the categories that do fit. I would then query the
field names/categories I was looking for via the field name and a value of
1.

It seems like one downside is that to optimally do this I would then also
have to index each of these BIT fields for fast retrieval/search/match.

I'm currently looking at about 15-20 categories, but I could see it going up
to 30-40, very unlikely beyond the 64 limitation of the SET field.

However, I wanted to toss this out and get pro/cons I might be missing,
especially as use of the SET field is new to me and I don't want to start
down that path and find out it was a bad way to go. TIA,

Terry
terryRemoveThisparkeratmyselfdotcom
Jul 20 '05 #1
3 1987
Terry Parker wrote:
I have a database that stores text (and other objects) which I would like to
categorize under multiple categories. I started out creating a "SET" field
with the different category names and I imagined being able to retrieve them
via matching on one or more categories and having this field indexed.

Or, I could also add a BIT (which I understand right now is the same as
TINYINT) field for each category and then assign 0 to rows that don't fit
that category and 1's to the categories that do fit. I would then query the
field names/categories I was looking for via the field name and a value of
1.

It seems like one downside is that to optimally do this I would then also
have to index each of these BIT fields for fast retrieval/search/match.

I'm currently looking at about 15-20 categories, but I could see it going up
to 30-40, very unlikely beyond the 64 limitation of the SET field.

However, I wanted to toss this out and get pro/cons I might be missing,
especially as use of the SET field is new to me and I don't want to start
down that path and find out it was a bad way to go. TIA,

Terry
terryRemoveThisparkeratmyselfdotcom


You is going down the hard way.

Try this.

Create a table with CategoryID and CategoryName

Create another table with LinkID, MainRecordID, CategoryID and index
away on this table

Now you have a flexible system in that if you add categories you don't
have to disturb the table structure because your categories are just a
record in a table.

I personally use this a lot and find it easier than adding new fields or
messing with decoding strings etc.

Hope this helps

Regards

Justin
Jul 20 '05 #2
Terry Parker wrote:
I have a database that stores text (and other objects) which I would like to
categorize under multiple categories. I started out creating a "SET" field
with the different category names and I imagined being able to retrieve them
via matching on one or more categories and having this field indexed.

Or, I could also add a BIT (which I understand right now is the same as
TINYINT) field for each category and then assign 0 to rows that don't fit
that category and 1's to the categories that do fit. I would then query the
field names/categories I was looking for via the field name and a value of
1.

It seems like one downside is that to optimally do this I would then also
have to index each of these BIT fields for fast retrieval/search/match.

I'm currently looking at about 15-20 categories, but I could see it going up
to 30-40, very unlikely beyond the 64 limitation of the SET field.

However, I wanted to toss this out and get pro/cons I might be missing,
especially as use of the SET field is new to me and I don't want to start
down that path and find out it was a bad way to go. TIA,

Terry
terryRemoveThisparkeratmyselfdotcom


You is going down the hard way.

Try this.

Create a table with CategoryID and CategoryName

Create another table with LinkID, MainRecordID, CategoryID and index
away on this table

Now you have a flexible system in that if you add categories you don't
have to disturb the table structure because your categories are just a
record in a table.

I personally use this a lot and find it easier than adding new fields or
messing with decoding strings etc.

Hope this helps

Regards

Justin
Jul 20 '05 #3
Terry Parker wrote:
I have a database that stores text (and other objects) which I would like to
categorize under multiple categories. I started out creating a "SET" field
with the different category names and I imagined being able to retrieve them
via matching on one or more categories and having this field indexed.

Or, I could also add a BIT (which I understand right now is the same as
TINYINT) field for each category and then assign 0 to rows that don't fit
that category and 1's to the categories that do fit. I would then query the
field names/categories I was looking for via the field name and a value of
1.

It seems like one downside is that to optimally do this I would then also
have to index each of these BIT fields for fast retrieval/search/match.

I'm currently looking at about 15-20 categories, but I could see it going up
to 30-40, very unlikely beyond the 64 limitation of the SET field.

However, I wanted to toss this out and get pro/cons I might be missing,
especially as use of the SET field is new to me and I don't want to start
down that path and find out it was a bad way to go. TIA,

Terry
terryRemoveThisparkeratmyselfdotcom


You is going down the hard way.

Try this.

Create a table with CategoryID and CategoryName

Create another table with LinkID, MainRecordID, CategoryID and index
away on this table

Now you have a flexible system in that if you add categories you don't
have to disturb the table structure because your categories are just a
record in a table.

I personally use this a lot and find it easier than adding new fields or
messing with decoding strings etc.

Hope this helps

Regards

Justin
Jul 20 '05 #4

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

Similar topics

13
by: Axehelm | last post by:
Okay, I'm in a debate over whether or not static methods are a good idea in a general domain class. I'm personally not a fan of static methods but we seem to be using them to load an object. ...
1
by: Ronnie Patton | last post by:
Hello everyone can you help me find some information out about pros and cons using a global.asa in any asp application My co-works are saying its your choice to use one or not based on what the...
0
by: Sniffle | last post by:
Thanks... Say you have a double opt in mailing list, of which the subcriber list is store in the db. Im still somewhat of a newb, so bear with me... are there any pros/cons as to keeping the...
0
by: Steve | last post by:
We've recently got a new Server in. The server has 16Gb of RAM, 8 cpus etc We now have a choice of sticking with Windows 2000 Advanced Server or going with Windows 2003 Enterprise edition. ...
112
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please,...
2
by: Precious | last post by:
I have to give a presentation on pros and cons of .NET to our clients, who are already using our VB6/SQL Server 2000 application....(Yes, we are too late)...Many of you must have done the same...
5
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating...
2
by: scott | last post by:
Hi, Just wondering what sort of problems and advantages people have found using stored procedures. I have an app developed in VB6 & VB.NET and our developers are starting to re-write some of the...
3
by: Andrea | last post by:
Hello everyone, I'd like to know which are the main pros and cons of using XML implementation in business organizations. >From a technical perspective, I find XML powerful, but looks like it is...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.