一天一道Sql题(day03)

将两个 SELECT 语句结合起来(一)_牛客题霸_牛客网

一天一道Sql题(day03)_第1张图片

思路:本题主要考查union all 连接两个sql语句,没什么难度

union (all):要求列的顺序、数据类型和列数保持一致。区别就是不加all会对连接的结果去重。union all不会去重

sql:

select * from OrderItems where quantity=100
union all
select * from OrderItems where prod_id like 'BNBG%'
order by prod_id

你可能感兴趣的:(sql,数据库)