Wednesday, April 8, 2009

Recall SQL

A. Select 
    select * from tablename
    select * from tablename where tab1=0 and tab2 is not null
    select tab1 from tablename
    select original_name AS new_name from tablename // change column name 
  select tab1 ||' ^*(&^*(^ '|| tab2 from tablename DB2, Oracle, PostgreSQL 
select concat(tab1, ' ^*(&^*(^ ',tab2) MySQL
select tab1
case when ** then ***
else **
end as ***
from tablename
select tab1 from tablename where tab2 like "%ER%" select tab1 from (select tab1 *******) x order by ******* //alias select ****** order by 3 decs
select ****** order by sbstr(tab1,len(tab1)-2)
select ****** order by case when ******* end

No comments: