select 常量 from 表;与 select * 

select*from 表; 查询出表中所有数据,性能比较差;

select 常量 from 表,查询出结果是所有记录数的常量,性能比较高;

selelct 常量from... 对应所有行,返回的永远只有一个值,即常量。

select a,b,c from 表名

 select 1 from 表名正常只会用来判断是否有数据(比如exists子句) 。而select * from ...是返回所有行的所有列;

如果要判断是否有结果使用

select 1 表 where .....

如果要返回数据,使用select 常量 from 表 where .....  或者 select * from 表 where ..... ;

select 常量 from 表 where .....;
select * from 表 where ..... ;


Select Count 表 与 Select Count(1)  表;

一般情况下,Select Count (*)和Select Count(1)两着返回结果是一样的如果表中没有主键,使用count(1)比count(*)快;

如果有主键,那么Select count(主键) 最快

count(*)和count(1)的结果一样,都包括对NULL的统计,而count(字段) 不包括NULL的统计;

实操中,选择便用 count(1)的情况比较多;

select*和select 常量 以及 select count(*) 和select count(1)的区别_表名