Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need:

  • a table containing keyword phrases;
  • a table containing URLs;
  • a table (or maybe a view) with keyword-URL pairs (referring to IDs of the two previous tables);
  • tables holding keywords/URLs for particular users.

The trouble is that both URLs and keywords may have several different forms. For example, both keywords and domains in URLs may be lowercase of uppercase, or is the same as (with trailing slash).

The question is how to manage user input when several possible variants are possible.

For now I can't formulate this question more exactly, as I have not formulated the exact specification of what I need. You are free to interpret my question in any way you may do it.

The sub-questions of this question:

  • Should I store both uppercase/lowercase variants or just the exact user input, generating my upper case version on the fly? (I need these "standardized" lowercase strings when doing actual URL queries from our server. It looks like for me that it's better to store them in the DB rather than to generate on the fly, for performance reason).
  • Should I use stored procedures to overcome such a deceiving DB layout, with that mess of lowercase and uppercase strings?

It is OK to use transactions. The DB is in MySQL.

share|improve this question
one thing to keep in mind in regards storing both upper and lower case variants will be dependent on the web server type. For instance Apache servers in general are case sensitive so is a different URL to – sdjuan Oct 23 '12 at 20:27
@sdjuan: and must be the same: - at least they are the same for Google what only interests me – porton Oct 23 '12 at 20:35
then clearly you do not need to store both :) – sdjuan Oct 24 '12 at 16:36
ahh my bad, to correct what I said earlier, it's the part after the scheme and host that is case sensitive with Apache, so can be different from but not apparently in your case. – sdjuan Oct 24 '12 at 16:44

I decided to do it in the following way:

  • Make a table strings with an ID and a VARCHAR, which will store both URLs and keywords, both normalized forms and unmodified user input.

  • Make a table seo which will hold (in addition to the row ID) four numeric fields referring to strings: unmodified user input for URLs and keywords, normalized URLs and keywords.

The list of normalized URL/keyword pair will be generated on the fly using DISTINCT.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.