I have two columns in my one postgreSQL Table.
The name of columns are: TO, FROM which denotes a range. Let say 100 - 200 (so here 100 will save in TO and 200 will get saved in FROM)
Now, the main problem is any number in this range will be never be used again. i.e we can't save (100,101,102...200 according to the example mentioned above).
I have to create a query in which I have to take data from the request and check whether the requested range is in the database or not.
Example: 100 -200 are already saved in database and I am getting request of following: 1) 100 -200 2) 150-250 3) 20 -150 4) 50 -280 e.t.c... All the above cases are false because at least one number is already saved in db
I am new to SQL can you please help in querying? I am using postgreSQL.
end2 >= start1 && end1>= start2