今日成果:
select c.customer_id,c.first_name,c.points, 'Bronze' as typefrom customers cwhere c.points < 2000unionselect c.customer_id,c.first_name,c.points, 'Silver' as typefrom customers cwhere c.points between 2000 and 3000
unionselect c.customer_id,c.first_name,c.points, 'Gold' as typefrom customers cwhere c.points > 3000order by first_name;-- union:用来合并多个表的查询结果,每个表的列数量需要保持一致否则会报错。
感谢各位读者查阅,欢迎各位👍点赞✍评论⭐收藏+关注!