[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

type like enum mysql

Posted on 2012-09-20
1
Medium Priority
?
562 Views
Last Modified: 2012-09-21
Type like enum but it can select more than one       such as t-shirt can be in man garment and women garment  if it not have type like that how can we do when somethings can classified in many category
0
Comment
Question by:teera
1 Comment
 
LVL 24

Accepted Solution

by:
johanntagle earned 2000 total points
ID: 38420417
What you need is not enum but a many-to-many relationship.  Basically have a table for your products, another for your categories, then a product_category "link" table.  Then you use SQL joins to find out which categories a product belongs to and/or which products are under a chosen category.

There are many tutorials on the web regarding the many-to-many relationship.  Here's a few:
http://xlinesoft.com/blog/2011/02/28/how-to-setup-many-to-many-relationships/
http://sqlrelationship.com/many-to-many-relationship/
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question