sql-statement

Java - Storing SQL statements in an external file

Java - Storing SQL statements in an external file I am looking for a Java library/framework/technique of storing SQL statements in an external file. The support team (including DBAs) should be able to alter (slightly) the statement to keep them in sync in case database schema changes or for tuning purposes. Here are the requirements: ...

Performance of VIEW vs. SQL statement

I have a query that goes something like the following: select <field list> from <table list> where <join conditions> and <condition list> and PrimaryKey in (select PrimaryKey from <table list> where <join list> and <condition list>) and PrimaryKey not in (select PrimaryKey from <table list> where <join list> and <condi...

How to produce "merge" of two data sets with select SQL statement (Oracle DBMS)?

Hi: What would be the insert SQL statement to merge data from two tables. For example I have events_source_1 table (columns: event_type_id, event_date) and events_source_2 table (same columns) and events_target table (columns: event_type_id, past_event_date nullalbe, future_event_date nullable). Events_source_1 has past events, Events...

How to create select SQL statement that would produce "merged" dataset from two tables(Oracle DBMS)?

Here's my original question: merging two data sets Unfortunately I omitted some intircacies, that I'd like to elaborate here. So I have two tables events_source_1 and events_source_2 tables. I have to produce the data set from those tables into resultant dataset (that I'd be able to insert into third table, but that's irrelevant). ev...

Adding where clause to this SQL statement

Hi, I asked a question earlier this week and i got this statement as the answer: select published, count(*) nbr from table1 group by published order by nbr desc limit 1 I now want to know how it is possible to add a where clause in to the statement so that i can limit the results i get to the different types of publications. My tabl...

Dynamically extend SQL statement - page search

In my model I have a string txtSearche with the value coming from a textbox like : "hello all friends" How can I write my statement dynamic adding WHERE text LIKE '%Text%' for each word additional? something like 3 times: WHERE Text LIKE '%@Text%'"; This is my code: string[] wordsFromTxtSearche = txtSearche.Split(' '); SqlCommand...

Recursively grab all data based on a parent id

We have a table where rows recursively link to another row. I want to pull data associated with a given parentId and all it's children. Where parentId is one from the root row. I thought I have seen or done something like that before, but I am unable to find it now. Can this be done in SQL or is it better to do this in code? I want the...

Please help me create sql statement for my tables?

I have 2 tables(1.Employee 2.Family). I want write a sql statement that produce the following output. Pictures Url : http://www.enterupload.com/8ryuew2anq0q/QUESTION1.jpg.html Mirror 1 : http://www.freeimagehosting.net/image.php?c9bea5b6b6.png Mirror 2 : http://0k.010.img98.com/out.php/i342669_QUESTION1.png ...