Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2013

    Unanswered: SQL Code for QUERY on DataBase

    Dear all,

    I have build a stand alone application using Java that processes text of my interest in some way that for now is irelevant.

    What I want to do know is the following, when I have a new string of text to be processed I first need to search whether this string exists in my Database. If it does then no processing will have to be made to that string. If it does not exist then my application will have to process the string and add a new entry to the data base table.

    This SQL code then will be implemented in Eclipse and my java app to manage.

    An example in order to make things more clear.

    Lets say that we have the string "dog"

    I need to search for this string in the table of the database (all columns).
    - If there is no "dog" entry then do some processing and store the string in the DB.
    - If there is a "dog" found in the DB then proceed to the next string, for example "cat" and do the same for all the new entries that I have to check on whether or not are present in my DB.

    I am using DBVisualizer pro to make some tests of my own but this are not so promising for now

    Any help appreciated!


  2. #2
    Join Date
    Mar 2013
    Any one?

  3. #3
    Join Date
    Jan 2007
    Provided Answers: 10
    INSERT INTO your_table (column_name)
    SELECT 'value e.g. "dog"'
    FROM   your_table
    WHERE  column_name <> 'value e.g. "dog"'
    Ensure you add a unique constraint to the column in question to enforce this unique values rule properly, too.
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts