I can\'t access my school database and haven\'t heard back from help desk, so I
ID: 3589381 • Letter: I
Question
I can't access my school database and haven't heard back from help desk, so I need help with these questions Thanks! Create and run the following queries. Copy each query from MySQL workbench for your answers. 1. Create and run a query that displays the MaintDesc, and MaintCost from the maintenance line table where the MaintDesc is ‘Transmission’. SELECT MaintDesc, MaintCost FROM maintenanceline WHERE MaintDesc=”Transmission”; 2. Create and run a query that displays the OpDesc, OpCost, from the operationcostline table where the OpCost is less than or equal to 3000.00. SELECT OpDesc, OpCost FROM Operationcostline WHERE OpCost<=3000.00; 3. Create and run a query that displays TruckID, FuelDate, Miles driven and CostPerGallon From the FuelUp table where the FuelDate is between 2013-11-06 and 2014-05-20. The Miles driven are calculated by subtracting the BeginOdometer from the EndOdometer. (The dates will be enclosed in single quotes). 4. Create and run a query that displays the Tr_DatePurch, Tr_PurchasePrice and the sales tax amount from the Truck table. The Sales tax amount is the Tr_PurchasePrice times the Tr_SalesTax. 5. Create a query that counts the records in the FuelUp table.
Explanation / Answer
1. Create and run a query that displays the MaintDesc, and MaintCost from the maintenance line table where the MaintDesc is ‘Transmission’.
SELECT MaintDesc, MaintCost FROM maintenanceline WHERE MaintDesc=”Transmission”;
2. Create and run a query that displays the OpDesc, OpCost, from the operationcostline table where the OpCost is less than or equal to 3000.00.
SELECT OpDesc, OpCost FROM Operationcostline WHERE OpCost<=3000.00;
3. Create and run a query that displays TruckID, FuelDate, Miles driven and CostPerGallon From the FuelUp table where the FuelDate is between 2013-11-06 and 2014-05-20. The Miles driven are calculated by subtracting the BeginOdometer from the EndOdometer. (The dates will be enclosed in single quotes).
select TruckID, FuelDate, (BeginOdometer - EndOdometer) as milesDriven, CostPerGallon
from FuelUp
where (FuelDate BETWEEN '2013-11-06' AND '2014-05-20');
4. Create and run a query that displays the Tr_DatePurch, Tr_PurchasePrice and the sales tax amount from the Truck table. The Sales tax amount is the Tr_PurchasePrice times the Tr_SalesTax.
select Tr_DatePurch, Tr_PurchasePrice, Tr_PurchasePrice * Tr_SalesTax as Sales_tax_amount
from Truck;
5. Create a query that counts the records in the FuelUp table.
select count(*) from FuelUp;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.