Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask PL-SQL Expert

Creating a SQL file

1. Open a new file in Notepad++ and save it to the location c:\mysql\bin, with the name lab8script.sql (the file extension should be .sql ). Add a MySQL comment to the top of the script file with your name. You will be adding SQL commands to this script file for the remainder of this lab.

2. Next, add to the script file, the command (use statement) to select the classicmodels database. Save the file (but leave it open). Your script now has one comment and one SQL command in it. We will continue to add SQL commands to this file in the next part of the lab.

3. Next, add to the script file, the SQL query that will return the order number, quantity ordered, price each and total cost of an order (quantity * price each) from the order details table. Label the calculated column as "Total Cost" and sort by the total cost.

If you do NOT see any data in your order details table, it means that you did not successfully complete the insert of data into that table as part of lab 4.  Please go back to the course content area in D2L and re-download the file MyLastName_Lab_Module4.txt.  When you open this file, you will see the insert command and all the data for the order details table.  Please review the instructions from lab 4 on how to run this insert statement and populate the order details table before you proceed with this lab. 

1. Now, we want to run the script and test it to see if our select statement is working. Save the lab8script.sql file (but you can leave it open in NotePad++).

2. Open a command prompt on your computer and get into the MySQL monitor. Execute the script file and check your output. If the output is correct, move on to the next step. If the output is wrong: edit the SQL statement in the script file, save the script file, re-run the script from the mysql prompt and check the output.

3. Due to an increase in overhead costs, the buying price of all items needs to be increased. Management wants to see a report before deciding how much each product will go up. Add to the script file, the SQL query that will run against the products table and return the product code, quantity in stock, current buying price and columns to show 3%, 5% and 10% over current buying price. Be sure to label the column headings for the calculated buying price as "3 Percent", "5 Percent" and "10 Percent."You will have a total of 6 column headings.

4. Next, add to the script file, the SQL query that will return the employee number and a concatenation of the first and last names of employees from the employee table. The names should be concatenated and display lastname first as "lastname, firstname"

a. Be sure all these queries are in your lab8script.sql file and that they run successfully and produce the correct results.

Then -

  1. Browse to your notepad++ window with Lab8Script.sql open
  2. Add to the script file, the SQL query that will return the number of offices in each country (Using group by and count)
  3. Be sure all these queries are in your lab8script.sql file and that they run successfully and produce the correct results

Go to

1. Browse to your notepad++ window with Lab8Script.sql open

2. Next, add to the script file, the SQL query that will return the average quantity of products ordered from the order details table

3. Next, add to the script file, the SQL query that will return the minimum quantity of products ordered from the order details table

4. Next, add to the script file, the SQL query that will return the maximum quantity of products ordered from the order details table

5. Be sure all these queries are in your lab8script.sql file and that they run successfully and produce the correct results.

Finally

1. Browse to your notepad++ window with Lab8Script.sql open

2. Next, add to the script file, the SQL query that will retrieve the number of customers in each city in which there are at least 2 customers. (Hint: use the count() function)

PL-SQL, Programming

  • Category:- PL-SQL
  • Reference No.:- M9522519

Have any Question?


Related Questions in PL-SQL

For this assignment you will be provided a database backup

For this assignment, you will be provided a database backup for a database called FinanceDB. You will have to restore this backup to your own version of SQL Server. All of the questions in this assignment relate to the F ...

Purpose of the assessment with ulo mapping the purpose of

Purpose of the assessment (with ULO Mapping) The purpose of this assignment is to develop skills in managing data in databases and to gain understanding of data model development and implementation using a commercially a ...

Continuing the project you have worked on in weeks 1-4 in

Continuing the project you have worked on in Weeks 1-4, in this final week, complete the following tasks: Refine your database and SQL statements by incorporating your instructor's feedback. Verify that the database comp ...

Assignment - queries functions and triggersaimthe aims of

Assignment - Queries, Functions and Triggers Aim The aims of this assignment are to: formulate SQL queries; populate an RDBMS with a real dataset, and analyse the data; design test data for testing SQL queries; create SQ ...

Complete the following tasksin microsoft access create the

Complete the following tasks: In Microsoft Access, create the database and tables that you identified in W3 Assignment 2. In Microsoft Word, write the SQL statements to create the database and tables. Write SQL statement ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As