题目如下图
备注:由于User在数据库中是关键字,不可用于表名,此处更名为Users.
话不多说,直接上答案:
(1).select uno, uname, uage
from users
where uage not between 20 and 30
and usex = 0;
(2).select gname, gprice
from goods
where gprice > 30
and gname like ‘%欢%’
or gname like ‘h%’
or gname like ‘F%’;
(3)select uname, toaPrice, decode(usex, 0, ‘女’, 1, ‘男’, usex), uage
from (select amount * gprice toaPrice, uname, usex, uage
from users, goods, sc
where users.uno = sc.uno
and goods.gno = sc.gno
and sc.sdate >= to_date(‘2016-01-01’, ‘yyyy-mm-dd’)
and sc.sdate < to_date(‘2017-01-01’, ‘yyyy-mm-dd’)
order by amount * gprice desc)
where rownum < 200
数据库sql简单面试题
最新推荐文章于 2021-08-26 14:26:00 发布