Chapter 11 Application Flashcards

1
Q

Issue a command to create a database CS340.

A

Create database CS340;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Provide code to create a table named Implement within the current database.

(get specifications for column from notes)

A

create table implement( article varchar(21) NOT NULL UNIQUE, msrp decimal(6,2) DEFAULT 0.00, CATEGORY char(7) NOT NULL, quantity int(1) default 1);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Add a column named id, data type int, unsigned, not null with the auto_increment type attribute and designate the primary key.

A

Alter table implement add id int unsigned not null auto_increment primary key;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Alter the Implement column named msrp to change the name to price.

A

alter table implement change msrp Price decimal(6,2) Default 0.00;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Modify price to set width to 7 and the precision to 2 decimal places.

A

alter table implement modify price decimal (7,2) Default 0.00;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Add a column to implement with name vendorId, data type int, and width 3. The vendor column is to be a foreign key constraint that references a table named Vendor with corresponding column also named vendorId.

A

Alter table implement add vendorId int(3);

Alter table implement add constraint implement_fk_Vendor foreign key (vendorId) references Vendor (vendorId);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Code a statement to rename the implement table to TractorImplement.

A

rename table implement to TractorImplement;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Create an index based on the category column of TractorImplement/

A

create index TractorImplement_category on TractorImplement (category);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly