I dont know if this would be called a special case since this will be my first time to have an idea where i would like to insert a value from the table with a condition
Is it possible?
For example:
I have a table 'tablename', and has a column 'values' and expected to put millions of unique values in that table. The constraints would be, that column will also accept NULL value and should not be set to primary key or unique(just following the specification). Therefore i must check if the new value is already exists on that table.
ALGO:
1. receive new value
2. check if the new value exists on the table
3. if not exists, add, else, dont
The following algorithm is simple and straight forward, however, when the number of rows will already on the hundreds of thousands in count, i observed the slight overhead... and when those rows will be on approximately a million or more... the system will be on its worst performance. Therefore, a question arises and that would be:
Is it possible to insert a value with a condition? like:
Expand|Select|Wrap|Line Numbers
- insert newvalue into tablename where newvalue doesnt exists in tablename