SQL Language (MOSC)

MOSC Banner

How to improve the following query

edited Dec 6, 2012 6:56PM in SQL Language (MOSC) 6 commentsAnswered ✓
Team,

Any suggestions on how to improve the following query.

- avalableInd is a boolean, has a value of 1 or 0.

- I am looking for only one shoeId with certain shoetype and availableInd=1.

select shoeId from (select shoeId from shoeGroup where shoeId in
 (select shoeId from shoe where shoeType=:"SYS_B_0" and availableInd=:"SYS_B_1") and availableInd=:"SYS_B_2")
where ROWNUM=:"SYS_B_3"

SQL> desc Shoe;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 SHOEID                                  NOT NULL VARCHAR2(100) : primary key
 SHOETYPE                                         VARCHAR2(25)
 avalableInd                                          NUMBER(10)

QL> desc ShoeGroup;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 SHOEID                                  NOT NULL VARCHAR2(100) : primary key
 ALTTYPE                                            VARCHAR2(25)
 avalableInd                                          NUMBER(10)

Thanks,

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center