Wednesday, February 14, 2007

SQL Tips

Select disctinct


How to count distinct rows within table

select count(*) from ( select distinct d1, d2, d3 , d4, d5, d6, d7, d8, d9 from in_all )


Update/Insert table


How to pass data from table to table:

For ex: pass data from table_b to table_a
truncate table TABLE_A
insert into TABLE_A select * from TABLE_B
truncate is different than the delete from TABLE command. My colleagues says that truncate command s faster ...

No comments: