需要sql-ex.ru/DML ex4的解决方案

需要sql-ex.ru/DML ex4的解决方案,sql,Sql,我陷入了sql ex的第四个DML问题 For each group of laptops with the identical model number, add following record into PC table: code: minimal code among laptops in the group +20; model: laptop's model number +1000; speed: maximal speed among laptops in the group;

我陷入了sql ex的第四个DML问题

For each group of laptops with the identical model number, add following record into PC table:
code: minimal code among laptops in the group +20;
model: laptop's model number +1000;
speed: maximal speed among laptops in the group;
ram: maximal ram size among laptops in the group *2
hd: maximal hd capacity among laptops in the group *2;
cd: default value;
price: maximal price among laptops in the group divided by 1.5.
Remark. Consider model number as numeric.
模式是

Product(maker, model, type)
PC(code, model, speed, ram, hd, cd, price)
Laptop(code, model, speed, ram, hd, screen, price)
Printer(code, model, color, type, price)
提前感谢您的帮助

尝试此查询

insert into PC (code,model,speed,ram,hd,price) 
select min(code)+20,model+1000,max(speed),max(ram)*2,max(hd)*2,max(price)/1.5 
from Laptop group by model

尝试使用select查找insert into以插入其他表中的数据,并使用group by(最小值、最大值)查找group by以获取需要插入的数据(和)