関係:
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 に対して 2 つの挿入ステートメントを使用するにはどうすればよいですか? 「INSERT INTO R(A,B,C) VALUES (a,b,c);」を知っています。INSERT INTO R VALUES xyz と INSERT INTO R VALUES sqr を実行する必要がありますか?
文字 B の場合、これは制約ですか? データベースを作り直して、InnoDB を使用する必要がありますか? (それが何を意味するのかわかりませんが、それが制約を使用できることを意味することを知っているだけです....?....
文字 C と D は、私にとってまっすぐです。「R WHERE から削除 ;」?
最後の 3 つは、これらの変更を行うにはどうすればよいですか? 私はUPDATEコマンドを確信しています。だから何か
UPDATE pc SET ram = 2*ram, hd = hd + 60;
事前に助けてくれてありがとう!