MySQL: how to search for a number that might not be unique
I'll try to make it easy by explaining an example.
So, I开发者_开发问答 consolidate data from two sources, namely 1 and 2. In each of the sources, it has a column "number" that has unique values within a source. But when A and B are consolidated (they have to be), it cannot be checked that they are unique. However, when consolidating 1 and 2, I created a column name "source" and tagged it with its source name (1 or 2). Therefore, if I want to look for a certain specific "number" I submit a query that looks for the desired number AND source.
Is there a better way to do this? It is working just fine because my database is small, but will this work well (i.e. fast, efficiently, etc.) as the DB grows? I mean, it won't have one million entries in the next few years, but I'd still like to perform it in a optimal manner.
The only other way I can think about is to keep separate "number" columns for different sources and query the appropriate columns.. but this will require additional columns to be added as I get additional sources. Hm.. what to do?
Your method should work just fine without causing any perceivable slow downs, if any at all.
精彩评论