mysql desc select_数据库里 desc 和 select 怎么用,代表什么意思?
展開全部
select 表字段名1,表字段名2 from 表名 order by 表排序字段名 desc。select 是選32313133353236313431303231363533e78988e69d8331333433653239擇哪些字符進行顯示。
desc表示按“表排序字段名”倒序顯示,不加desc,表示正序顯示。
例如:select * from student where 總學分 in(70,80)
IS NULL 或IS NOT NULL:如果判斷某一列是否為空或不為空;
distinct:從返回的結果數據集合中刪除重復的行。
select distinct 總學分?from student order by 總學分。
擴展資料
select語句可 以用回車分隔
$sql="select * from article where id=1"和? $sql="select * from article where id=1"
都可以得到正確的結果,但有時分開寫或許能 更明了一點,特別是當sql語句比較長時。
批量查詢數據
可以用in 來實現
$sql="select * from article where id? ;in(1,3,5)"
使用concat連接查詢的結果
$sql="select concat(id,"-",con)? as res from article where id=1"
返回 "1-article content"
使用locate
用法: select locate("hello","hello baby");返回1
不存在返回 0
使用group by
以前一直沒怎么搞明group by? 和 order by,其實也滿簡單的,group by 是把相同的結 果編為一組
exam:$sql="select city ,count(*)? from customer group by city";
這句話的意 思就是從customer表里列出所有不重復的城市,及其數量(有點類似distinct)
group by 經常與AVG(),MIN(),MAX(),SUM(),COUNT()一起使用
總結
以上是生活随笔為你收集整理的mysql desc select_数据库里 desc 和 select 怎么用,代表什么意思?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Opencv存图读图
- 下一篇: 重庆到西安谋划高铁 望融入西三角经济圈