SQL查询某字段最小值

SQL查询某字段最小值:(使用min() max())

SELECT *
FROM  stutable
WHERE (age IN
          (SELECT MIN(age)
         FROM stutable));


SQL查询某字段最小值:(不使用min() max())

 例如数据表中有一列为工资,查询工资最高的,可以这么写语句: 
 

sql server 数据库下的:
select   top   1   工资   from   table1   order   by   工资   desc;

或者:select   top(1)   *  from   table1   order   by   工资   desc;

其他的类似 
select   top   1   with   ties   id,工资   from   table1   order   by   工资   asc
最少

MySql数据库下使用:

select * from stutable order by age asc limit 0,1

你可能感兴趣的:(SQL查询某字段最小值)