MySQL学习笔记7:基本查询_MySQL
mysql
bitsCN.com
参考表:student
多字段查询
mysql> select id,name,birth from student;
ログイン後にコピー
所有字段查询
mysql> select * from student;
ログイン後にコピー
where指定查询
mysql> select * from student where id=901;mysql> select * from student where id>=904;mysql> select name from student where department='计算机系';
ログイン後にコピー
in指定集合查询
mysql> select * from student where birth in(1988,1990);mysql> select * from student where id in(903,906);
ログイン後にコピー
not in非范围查询
mysql> select * from student where birth not in(1990,1998);
ログイン後にコピー
between and指定范围查询
mysql> select * from student where birth between 1986 and 1988;
ログイン後にコピー
not between and不在指定范围的查询
mysql> select * from student where id not between 904 and 906;
ログイン後にコピー
like字符串匹配查询
mysql> select * from student where name like '_三';mysql> select * from student where name like '张三';mysql> select * from student where name like '张%';
ログイン後にコピー
not like不匹配查询
mysql> select * from student where name not like '张%';
ログイン後にコピー
空值查询
mysql> select * from student where address is null;
ログイン後にコピー
and多条件查询
mysql> select * from student where name like '张%' and birth>1985;mysql> select * from student where name like '张%' and birth>1985 and id like '%3';
ログイン後にコピー
or多条件查询
mysql> select * from student where id=905 or birth=1988;mysql> select * from student where id=905 or birth=1988 or sex='女';
ログイン後にコピー
distinct查询结果不重复
mysql> select distinct sex from student;mysql> select distinct department from student;
ログイン後にコピー
order by查询结果排序
mysql> select * from student order by birth;mysql> select * from student order by birth asc;mysql> select * from student order by birth desc;
ログイン後にコピー
group by分组查询
mysql> select sex,group_concat(name) from student group by sex;mysql> select sex,count(name) from student group by sex;
ログイン後にコピー
limit限制查询结果数量
mysql> select * from student limit 2;mysql> select * from student limit 1,3;
ログイン後にコピー
bitsCN.com
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事
R.E.P.O.説明されたエネルギー結晶と彼らが何をするか(黄色のクリスタル)
2週間前
By 尊渡假赌尊渡假赌尊渡假赌
レポ:チームメイトを復活させる方法
4週間前
By 尊渡假赌尊渡假赌尊渡假赌
ハローキティアイランドアドベンチャー:巨大な種を手に入れる方法
3週間前
By 尊渡假赌尊渡假赌尊渡假赌
スプリットフィクションを打ち負かすのにどれくらい時間がかかりますか?
3週間前
By DDD
R.E.P.O.ファイルの保存場所:それはどこにあり、それを保護する方法は?
3週間前
By DDD

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック
Gmailメールのログイン入り口はどこですか?
7313
9


Java チュートリアル
1625
14


CakePHP チュートリアル
1348
46


Laravel チュートリアル
1260
25


PHP チュートリアル
1207
29



PHP で MySQL クエリのパフォーマンスを最適化するにはどうすればよいですか?

PHP で MySQL のバックアップと復元を使用するにはどうすればよいですか?

PHP を使用して MySQL テーブルにデータを挿入するにはどうすればよいですか?

データベースにおける Java 列挙型のアプリケーション シナリオは何ですか?

MySQL 8.4 で mysql_native_password がロードされていないエラーを修正する方法

PHP で MySQL ストアド プロシージャを使用するにはどうすればよいですか?

PHP を使用して MySQL テーブルを作成するにはどうすればよいですか?
