表名:zc36
`id` int(11) NOT NULL auto_increment, //字段id,递增
`num` int(11) NOT NULL, //数量
`title` varchar(50) NOT NULL, //标题
PRIMARY KEY (`id`) //id 为主键
绝对相等查询(如查询的是域名为'zc36.net'的记录):
SELECT * FROM `zc36` WHERE title='zc36.net'
查询开头是"zc36的例子:
select * from zc36 where title like 'zc36%'
查询结尾是"zc36的例子:
select * from zc36 where title like '%zc36'
查询包含"zc36的例子:
select * from zc36 where title like '%zc36%'
取出多少条的语句例子:
select * from zc36 where num>10 order by num desc limit 2
*num大于10的并取出num最大的两条,desc是按递减排序,asc是递培排序
查询总的条数的例子:
select count(id) from zc36
查询num的汇总数量的例子:
SELECT sum( num ) FROM `zc36
查询num的平均数的例子:
SELECT avg( num ) FROM `zc36`
如有什么问题请在下面回复,本站点是:
简单的查询语句select例子:
表名:zc36
`id` int(11) NOT NULL auto_increment, //字段id,递增
`num` int(11) NOT NULL, //数量
`title` varchar(50) NOT NULL, //标题
PRIMARY KEY (`id`) //id 为主键
绝对相等查询(如查询的是域名为'zc36.net'的记录):
SELECT * FROM `zc36` WHERE title='zc36.net'
查询开头是"zc36的例子:
select * from zc36 where title like 'zc36%'
查询结尾是"zc36的例子:
select * from zc36 where title like '%zc36'
查询包含"zc36的例子:
select * from zc36 where title like '%zc36%'
取出多少条的语句例子:
select * from zc36 where num>10 order by num desc limit 2
*num大于10的并取出num最大的两条,desc是按递减排序,asc是递培排序
查询总的条数的例子:
select count(id) from zc36
查询num的汇总数量的例子:
SELECT sum( num ) FROM `zc36
查询num的平均数的例子:
SELECT avg( num ) FROM `zc36`
如有什么问题请在下面回复,本站是http://www.zc36.net