select order_num,sum(item_price*quantity) as total_price
from OrderItems
/*
where条件语句后面不能加聚合函数(分组函数)
having 不能单独使用,必须和group by 联合使用
*/
 group by order_num
-- having total_price >=1000 错误,不能使用别名
 having sum(item_price*quantity) >= 1000

order by order_num;