472,353 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 1937
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...
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...
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...
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...
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...
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...
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...
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.