1

Relations: Model is the primary key for each table

Product( maker, model, type )
PC( model, speed, ram, hd, price)
Laptop( model, speed, ram, hd, screen, price)
Printer( model, color, type, price)

My first question is how I properly start and rollback a transaction. what I have been doing is

START TRANSACTION; 
--- my sql says ok
--- do my queries (8 rows affected)
ROLLBACK
--- Mysql says ok but 0 rows affected. 

I cannot seem to get any of my changes to rollback after a transaction is started. Once I can figure this out I can start on my next few problems. I am having trouble with this one specifically

  • 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 than the original pc.

All the model numbers for pc's are from 1000 to 1013, so to make all the model numbers 1100 or above we can just add 100 to the pc's model number

I need to insert into the products relation the new models, maker, and type for the new laptops also I need to insert the new laptops into the laptop relation. I know I will have a subquery within it near this

(SELECT * FROM pc)

So I am taking the pc relation, adding a screen column where everything is set to 17, I then am adding this whole relation to the laptop relation. I also need to add the fact that that each manufacturer or pc's now make a latptop for every model of pc they make.

This is very confusing to me I am not sure how to work through it.

Any help is appriciated.

4

0 回答 0