Tuesday 15 July 2014

using BETWEEN Operator with Integer and Text Value

BETWEEN operator in SQL selects values within a range. The values can be numbers or text.

SQL> Select * from boys;

    BOY_ID BOY                      TOY_ID DEPT
---------- -------------------- ---------- --------------------
         1 Jana                          3 elec
         6 Sam                           8 aero
         2 Giri                          3 csc
         4 Giri                          7 csc
 

BETWEEN operator on integer values are selected as below

SQL> Select * from boys where TOY_ID BETWEEN 1 AND 7;

    BOY_ID BOY                      TOY_ID DEPT
---------- -------------------- ---------- --------------------
         1 Jana                          3 elec
         2 Mess                          3 csc
         4 Mess                          7 csc

On using text value with BETWEEN operator, the text value is compared against the column values and result set is produced.
In this example the boy 'Sam' is not selected as 'Sam' is  > 'S'. (i.e. Same > Sam > S)

SQL> Select * from boys where boy BETWEEN 'J' AND 'S';

    BOY_ID BOY                      TOY_ID DEPT
---------- -------------------- ---------- --------------------
         1 Jana                          3 elec
         2 Mess                          3 csc
         4 Mess                          7 csc

On using full text 'Sam' on BETWEEN operator, the row holding column value 'Sam' 'is selected.

SQL> Select * from boys where boy BETWEEN 'J' AND 'Sam';

    BOY_ID BOY                      TOY_ID DEPT
---------- -------------------- ---------- --------------------
         1 Jana                          3 elec
         6 Sam                           8 aero
         2 Mess                          3 csc
         4 Mess                          7 csc






 

write a HYPERLINK into excel using jxl

HYPERLINK's can be written into excel using java using jxl. This will be useful to add screenshots of the web pages captured on running automated test cases through selenium

String scn = "HYPERLINK(\"D:\\snaps\\"+step_num+".jpg\",\"Click\")";
Formula link = new Formula(3,0,scn);
wws.addCell(link);