SELECT u.product_id,ROUND(SUM(p.price*u.units)/SUM(u.units),2) average_price
FROM UnitsSold u
INNERJOIN Prices p
ON u.product_id=p.product_id AND u.purchase_date BETWEEN p.start_date AND p.end_date
GROUPBY u.product_id
1.3 运行截图
2 项目员工Ⅰ
2.1 题目内容
2.1.1 基本题目信息
2.1.2 示例输入输出
2.2 示例sql语句
SELECT p.project_id,ROUND(AVG(e.experience_years),2) average_years
FROM Employee e
INNERJOIN Project p
ON e.employee_id=p.employee_id
GROUPBY p.project_id
2.3 运行截图
3 各赛事的用户注册率
3.1 题目内容
3.1.1 基本题目信息
3.1.2 示例输入输出
a 示例输入
b 示例输出
3.2 示例sql语句
SELECT r.contest_id,ROUND(count(u.user_name)*100/(SELECTcount(user_id)FROM Users),2) percentage
FROM Register r
INNERJOIN Users u
ON r.user_id=u.user_id
GROUPBY r.contest_id
ORDERBY percentage desc,contest_id asc