2018-11-01
閱讀量:
978
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)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
1條評論