热线电话:13121318867

登录
2018-11-01 阅读量: 936
MySQL中的where查询

create table fruits

(

f_id char(10) not full,

s_id int not full,

f_name char(255) not full,

f_price decimal(8,2) not full,

primary key(f_id)

);

create table suppliers

(

s_id int primary key,

s_name varchar(50),

s_city varchar(30)

);

看表的一部分:

select s_name,s_city from suppliers;

例:

(1)、查询价格为10.2元的水果名称

select f_name,f_price

from fruits

where f_price=10.2;

(2)、查找名称为apple的水果价格

select f_name,f_price

from fruits

where f_name='apple';

说明f_name可省略,只是为了方便查看。

(3)、查询价格小于10元的水果名称

select f_name,f_price

from fruits

where f_price<10;

0.0000
6
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子