关系:
Product( maker, model, type )
PC( model, speed, ram, hd, price)
Laptop( model, speed, ram, hd, screen, price)
Printer( model, color, type, price)
A. Using two INSERT statements, store in the database the fact that PC model 1100 is made by manufacturer C, has a speed of 3.2, and RAM 1024, hard disk 180, and sells $2499
B. Insert the facts that for every pc there is a laptop with the same manufacturer, speed, ram, and hard disk, a 17 inch screen, a model number 1100 greater, and a price 500 more
C. Delete all pc's with less than 100 gigabytes of hd space
D. Delete all laptops made by a manufacturer that doesn't make printers
E. Manufacturer A buys Manufacturer B. Change all products made by b so now they are made by a.
F. For each pc, double the amount of RAM and add 60gb to the amount of hd.
G. For each laptop made by manufacturer b, add one inch to the screen size and subtract 100 from the price
首先对于这些示例中的每一个,我将修改我的数据库,有没有办法快速复制我的数据库,以防我搞砸了更改?
我该如何对问题 A 使用两个插入语句?我知道“插入 R(A,B,C)值(a,b,c);” 我应该插入 R 值 xyz 和插入 R 值 sqr 吗?
对于字母 B,这是一个约束吗?我是否需要重新制作我的数据库并让它使用 InnoDB?(我不确定这意味着什么,我只知道这意味着我可以使用约束......?......
字母 C 和 D 对我来说很困难。“从 R 中删除;” ?
对于最后三个,我该如何进行这些更改?我很确定 UPDATE 命令。所以像
UPDATE pc SET ram = 2*ram, hd = hd + 60;
提前感谢您的帮助!