Home » SQL & PL/SQL » SQL & PL/SQL » few condition to be met out of many conditions
few condition to be met out of many conditions [message #210542] Thu, 21 December 2006 04:49 Go to next message
nids2307
Messages: 8
Registered: December 2006
Location: India
Junior Member
PlZ. tell me the logic to solve the problem mentioned below:-


Database relations:

Classes(class, type, country, numGuns, bore, displacement)
Ships(name, class, launched)

Determine names of all the ships in Ships table, which meet at least the combination of any four criteria from the following list:
numGuns = 8
bore = 15
displacement = 32000
type = bb
launched = 1915
class=Kongo
country=USA



We can't go with all permutations and combinations as it will be very cumbersome, any other way neone can suggest?

Re: few condition to be met out of many conditions [message #210556 is a reply to message #210542] Thu, 21 December 2006 05:25 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Tip: use CASE or DECODE to translate a desired value to 1.
Then sum the 1's and check if a row has more than 4.

Now you give it a try.
Previous Topic: Instead of clause in a trigger
Next Topic: Problem in number format mask (merged)
Goto Forum:
  


Current Time: Sat Dec 03 18:15:46 CST 2016

Total time taken to generate the page: 0.11121 seconds