首先用mysql建一张表:
CREATE TABLE Employee(
id int,
first_name VARCHAR(15),
last_name VARCHAR(15),
city VARCHAR(10),
);
然后向表中插入若干数据:
insert into Employee(id,first_name,last_name,City) values (1,\'Jason\',\'Martin\',\'Toronto\');
insert into Employee(id,first_name,last_name,City) values (2,\'Alison\',\'Mathews\',\'Vancouver\');
insert into Employee(id,first_name,last_name,City) values (3,\'James\',\'Smith\',\'Vancouver\');
insert into Employee(id,first_name,last_name,City) values (4,\'Celia\',\'Rice\',\'Vancouver\');
insert into Employee(id,first_name,last_name,City) values (5,\'David\',\'Larry\',\'New York\');
查询Employee表结
select *from Employee
结果集为:
| id | first_name | last_name | city |
| 1 | Jason | Martin | Toronto |
| 2 | Alison | Mathews | Vancouver |
| 3 | James | Smith | Vancouver |
| 4 | Celia | Rice | Vancouver |
| 5 | David | Larry | New York |
如果我们需要查询city为Vancouver的所有数据;此时可以使用where语句:
select *from Employee where city=\'Vancouver\'
结果集为:
| id | first_name | last_name | city |
| 2 | Alison | Mathews | Vancouver |
| 3 | James | Smith | Vancouver |
| 4 | Celia | Rice | Vancouver |
以上是mysql where 语句的使用实例,希望对大家学习有所帮助。
继续阅读与本文标签相同的文章
上一篇 :
谷歌「量子霸权」霸道在哪?
下一篇 :
被低估的艺术培训市场,被高估的在线教育魔力?
-
充分利用系统磁盘空间,Windows 7操作系统如何创建压缩文件夹
2026-05-14栏目: 教程
-
iPhone11系列性能测试:碾压华为麒麟990,性能超越它两倍!
2026-05-14栏目: 教程
-
手机导航是怎样判断路况的?不仅是通过卫星,这几个原因使导航更智能
2026-05-14栏目: 教程
-
手机信号突然从“4G”变成“E”,是什么意思?客服给出答案
2026-05-14栏目: 教程
-
互联网架起“乌镇式生活”
2026-05-14栏目: 教程
