SQL Class Exercise: Table Administration
0. Create a table named TractorImplement from these column definitions:
Column Name Type Constraint
--------------------------- ------------ -----------------------------
article varchar(21) primary key
msrp decimal(6,2)
category char(7)
quantity int(1)
1. Issue a show create table command for TractorImplement.
2. Load TractorImplement with data from a file named implement.csv .
3. Query TractorImplement.
4. Rename TractorImplement to Implement.
5. Alter Implement to drop the primary key.
6. Add a column named id, data type int, unsigned, not null with the
auto_increment type attribute and designated the primary key. [Place id
first in left-to-right sequence.]
7. Change the name of the msrp column to price.
8. Modify price to set the width to 7 and the precision to 2 decimal places.
9. Use the show command to display the Implement table definition.
implement.csv
Box Blade-4 ft,429.99,grader,7
Cultivator,224.99,tillage,5
Finishing Mower-5 ft,1379.00,cutter,5
Finishing Mower-6 ft,1599.00,cutter,8
Landscape Rake,469.99,utility,4
Middle Buster,138.62,tillage,0
Post Hole Digger-6 ft,449.99,utility,2
Rear Blade-5 ft,319.99,grader,5
Rotary cutter-4 ft,749.99,cutter,0
Rotary Tiller-4 ft,1449.00,tillage,6
Rotary Tiller-5 ft,1499.99,tillage,4
Seeder Spreader,379.99,planter,3
Sub-Soiler,179.99,tillage,3
Trailer Mover,168.65,utility,4
Wire Roller,319.99,utility,0