sql - What sort of database design would I need to use in case I wanted users to save tags, and be able to call already used tags? -


I am trying to implement a feature similar to the tag feature of StackOverflow. This user can create a new tag or type by dragging a list of similar tags already created.

This is a great feature on this site and I am sad that most sites have nothing like this. It's both strong, and yet very flexible and best: driven by the community.

Then I have these two applause:

  Company ID Email Name Company Size Country Opener Industry Industry Industry ID Description  

Every time When a user writes a new tag, I want to create one with a unique ID, and I'm also able to find existing tags.

Does this database design allow easy and efficient implementation of this feature?

If not, please give some guidance. Although

Although there is no great information to go, what you have listed should be ok . ('Description' field 'tag' in industry table, etc.).

As you can imagine, all the real work is done outside of SQL, where you will need ..

  1. (potential) new tags () which are now Add up does not exist.
  2. Associate the industry with the supplied tag (s).
  3. (potentially) cut the previously used tags which can no longer be used.

... every time you edit an industry.

He said, the key is that the limit of your proposed setup is that each company can be related to only one industry (i.e.: it can only be linked to an industry tag.)

In this way, you may want to consider a schema with the line of

  Company ID ... CountryOffOnGreen Industries ID Details Company Industry Lookup Company ID Industry ID < / Code> 

... which you have with the given company Industries / tags associated with them.

Update ...

For example, under this setup, you will use to get all the tags associated with Company ID 1 ...

  Select Industry IndustryDescription FROM (CompanyIndustriesLookup, Industries) WHERE companyID = 1 and industryID = Industries. DSKC ASC by ID Industries;  

On a similar basis, to get all the companies tagged with an "test" industry, you will use ...

  SELECT Company.name (Company, Industries, Company Industries Lookup) WHERE Company.id = CompanyIndustriesLookup.companyID and Industries.id = CompanyIndustriesLookup.industryID and industries.description = "Trial" ORDER BY Company.name ASS  < / Pre> 

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -