Bluehost.com Web Hosting $6.95

multiple compare

This is a discussion on multiple compare within the MySQL Database forums, part of the Database Forums category; Hi, I need to check a set of links against a large database that I have created. As the links ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-05-2007
carlbernardi@gmail.com
 
Posts: n/a
Default multiple compare

Hi,

I need to check a set of links against a large database that I have
created. As the links get added I check one by one that they don't get
added twice. I was wondering if it is possible to pass the entire SET
of links to be checked all at once instead of one by one. I am hoping
this will make my application run fast.

Thanks

Carl

Reply With Quote
  #2 (permalink)  
Old 03-05-2007
Gordon Burditt
 
Posts: n/a
Default Re: multiple compare

>I need to check a set of links against a large database that I have
>created. As the links get added I check one by one that they don't get
>added twice.


A unique index on that field will prevent entering the same link twice,
without needing to run a separate query to check first.

>I was wondering if it is possible to pass the entire SET
>of links to be checked all at once instead of one by one. I am hoping
>this will make my application run fast.


If you use INSERT with multiple records and get an error about a
duplicate record, you may not know which record is the duplicate.


Reply With Quote
  #3 (permalink)  
Old 03-05-2007
carlbernardi@gmail.com
 
Posts: n/a
Default Re: multiple compare


Thanks Gordon,

I was wondering if a column could be made unique. I looked into
altering the column to unique that I am using but I have been having
problems. Could you give me a hint as to how I could do this or
should I just recreate the table with the column being unique.

Thanks,

Carl


On Mar 4, 6:40 pm, gordonb.n6...@burditt.org (Gordon Burditt) wrote:
> >I need to check a set of links against a large database that I have
> >created. As the links get added I check one by one that they don't get
> >added twice.

>
> A unique index on that field will prevent entering the same link twice,
> without needing to run a separate query to check first.
>
> >I was wondering if it is possible to pass the entire SET
> >of links to be checked all at once instead of one by one. I am hoping
> >this will make my application run fast.

>
> If you use INSERT with multiple records and get an error about a
> duplicate record, you may not know which record is the duplicate.



Reply With Quote
  #4 (permalink)  
Old 03-05-2007
Rik
 
Posts: n/a
Default Re: multiple compare

carlbernardi@gmail.com <carlbernardi@gmail.com> wrote:
> I was wondering if a column could be made unique. I looked into
> altering the column to unique that I am using but I have been having
> problems. Could you give me a hint as to how I could do this or
> should I just recreate the table with the column being unique.


ALTER TABLE tablename ADD UNIQUE (fieldname);

If there are already duplicates, you might want to remove them first.
--
Rik Wasmus
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:03 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0