Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

part table: create table part (partnum numeric(10) not null, description varchar

ID: 3804476 • Letter: P

Question

part table:

create table part
(partnum numeric(10) not null,
description varchar(20) not null,
price decimal(10,2) not null);

insert into part values
('54', 'PEDALS', '54.25');

insert into part values
('42', 'SEATS', '24.50');

insert into part values
('46', 'TIRES', '15.25');

insert into part values
('23', 'MOUNTAIN BIKE', '350.45');

insert into part values
('76', 'ROAD BIKE', '530.00');

insert into part values
('10', 'TANDEM', '1200.00');

customer table:

create table customer
(name varchar(10) not null,
address varchar(10) not null,
state varchar(6) not null,
zip varchar(10) not null,
phone varchar(10) null,
remarks varchar(30) not null);

insert into customer values
('TRUE WHEEL', '550 HUSKER', 'NE', '58702', '555-4545', 'NONE');

insert into customer values
('BIKE SPEC', 'CPT SHRIVE', 'LA', '45678', '555-1234', 'NONE');

insert into customer values
('LE SHOPPE', 'HOMETOWN', 'KS', '54678', '555-1278', 'NONE');

insert into customer values
('AAA BIKE', '10 OLDTOWN', 'NE', '56784', '555-3421', 'JOHN-MGR');

insert into customer values
('JACKS BIKE', '24 EGLIN', 'FL', '34567', '555-2314', 'NONE');

orders table:

create table orders
(orderedon date,
name varchar(10) not null,
partnum numeric(10) not null,
quantity numeric(10) not null,
remarks varchar(30) not null);

insert into orders values
('1996-05-19', 'TRUE WHEEL', '76', '3', 'PAID');

insert into orders values
('1996-09-02', 'TRUE WHEEL', '10', '1', 'PAID');

insert into orders values
('1996-06-30', 'TRUE WHEEL', '42', '8', 'PAID');

insert into orders values
('1996-06-30', 'BIKE SPEC', '54', '10', 'PAID');

insert into orders values
('1996-05-30', 'BIKE SPEC', '23', '8', 'PAID');

insert into orders values
('1996-01-17', 'BIKE SPEC', '76', '11', 'PAID');

insert into orders values
('1996-01-17', 'LE SHOPPE', '76', '5', 'PAID');

insert into orders values
('1996-06-01', 'LE SHOPPE', '10', '3', 'PAID');

insert into orders values
('1996-06-01', 'AAA BIKE', '10', '1', 'PAID');

insert into orders values
('1996-07-01', 'AAA BIKE', '76', '4', 'PAID');

insert into orders values
('1996-07-01', 'AAA BIKE', '46', '14', 'PAID');

insert into orders values
('1996-07-11', 'JACKS BIKE', '76', '14', 'PAID');

mysql database

Choose the appropriate field(s) and create indexes for the CUSTOMER, PART, and ORDERS tables. Show the indexes are in effect using a SELECT statement. Drop the indexes.

Explanation / Answer

part table:

Create Index idx_price on part(price);

Select * from idx_price;

drop idx_price on part;

customer table:

Create Index idx_cname on customer(name);

Select * from idx_cname;

drop idx_cname on customer;

Create Index idx_phone on customer(phone);

Select * from idx_phone;

drop idx_phone on customer;

orders table:

Create Index idx_oname on orders(name);

Select * from idx_oname;

drop idx_oname on orders;

Create Index idx_quantity on orders(quantity);

Select * from idx_quantity;

drop idx_quantity on orders;