Tuesday, January 24, 2012

SQL SELECT QUERY

Sql have Several Query for interect with Database.

Select Query is one of the most important Query here we will see the different Uses of Select Query.

* To simply select the all Datas from Database Table

 select  *  from table_name


 above statements select all the  rows from Data Table.

* To count just number of rows(all)  from table  


select count(*) from table_name 


above query count all the rows from given table

* now if you want count distinct rows from table you have to specify distinct word before count key word
like 


select  count( distinct  column_name) from table_name 


above query  remove duplication from count result .

* Use select method to insert data from one table to another table 


insert into tbl_insert_table (first_column , last_column)
select first_value , last_value from tbl_select_table 

No comments:

Post a Comment