Question

Save your select statements as a script. Place the semicolon at the end of each SQL...

Save your select statements as a script. Place the semicolon at the end of each SQL statement.

Please number your select statements from 1 to 8 in your script and comment out each number. Include your name and student number as a comment at the top of your script.

The name of the script has to be Assignment1_JohnSmith. Instead of JohnSmith use your First Name and Last Name. Upload your script trough Blackboard.

Use SQL Developer to create the My Guitar Shop database, to review the tables in this database, and to enter SQL statements and run them against this database.

Use SQL Developer to create the My Guitar Shop database

  1. Start SQL Developer.
  2. Connect as system/system.
  3. Open the script file named create_mgs_user.sql from Blackboard MGS folder.
  4. Execute the entire script by clicking the Run Script button in the code editor toolbar or by pressing F5. When you do, the Output window displays messages that indicate whether the script executed successfully. You must be connected as the system user for this script to execute successfully. If you get an error the first time you run this script, run it again.
  5. Open the script file named create_mgs_tables.sql from the same folder.
  6. Execute the entire script by clicking the Run Script button in the code editor toolbar or by pressing F5. When you do, the Output window displays messages that indicate whether the script executed successfully. If you get an error the first time you run this script, run it again.

Use SQL Developer to review the My Guitar Shop database

  1. Create a connection named mgs for the user named mgs. The password for this user should be “mgs”.
  2. In the Connections window, expand the node for the connection named mgs so you can see all of the database objects it contains. If this connection isn’t displayed in the Connections window, you may need to click on the Refresh button to display it.

Write the following SQL Statements:

  1. Write a SELECT statement that returns one row for each customer that has orders with these columns:

The email_address from the Customers table

A count of the number of orders

The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.)

Return only those rows where the customer has more than 1 order.

Save your select statements as a script. Place the semicolon at the end of each SQL statement.

Please number your select statements from 1 to 8 in your script and comment out each number. Include your name and student number as a comment at the top of your script.

The name of the script has to be Assignment1_JohnSmith. Instead of JohnSmith use your First Name and Last Name. Upload your script trough Blackboard.

Use SQL Developer to create the My Guitar Shop database, to review the tables in this database, and to enter SQL statements and run them against this database.

Use SQL Developer to create the My Guitar Shop database

  1. Start SQL Developer.
  2. Connect as system/system.
  3. Open the script file named create_mgs_user.sql from Blackboard MGS folder.
  4. Execute the entire script by clicking the Run Script button in the code editor toolbar or by pressing F5. When you do, the Output window displays messages that indicate whether the script executed successfully. You must be connected as the system user for this script to execute successfully. If you get an error the first time you run this script, run it again.
  5. Open the script file named create_mgs_tables.sql from the same folder.
  6. Execute the entire script by clicking the Run Script button in the code editor toolbar or by pressing F5. When you do, the Output window displays messages that indicate whether the script executed successfully. If you get an error the first time you run this script, run it again.

Use SQL Developer to review the My Guitar Shop database

  1. Create a connection named mgs for the user named mgs. The password for this user should be “mgs”.
  2. In the Connections window, expand the node for the connection named mgs so you can see all of the database objects it contains. If this connection isn’t displayed in the Connections window, you may need to click on the Refresh button to display it.

Write the following SQL Statements:

  1. Write a SELECT statement that returns one row for each customer that has orders with these columns:

The email_address from the Customers table

A count of the number of orders

The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.)

Return only those rows where the customer has more than 1 order.

Homework Answers

Answer #1

1. Write a SELECT statement that returns one row for each customer that has orders with these columns:

  • The email_address from the Customers table
  • A count of the number of orders
  • The total amount for each order (Hint: First, subtract the discount amount from the price. Then, multiply by the quantity.)
  • Return only those rows where the customer has more than 1 order.

Answer:

SELECT email_address as Email_Address, count(orders)as No_Orders, ((price - discount_amount) * quantity) as Total_amount from Customer where orders > 1 ;

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create...
A. Create a PowerShell script named “restore.ps1” within the “Requirements2” folder. For the first line, create a comment and include your first and last name along with your student ID. Note: The remainder of this task shall be completed within the same script file, “restore.ps1.” B. Write a single script within the “restore.ps1” file that performs all of the following functions without user interaction: 1. Create an Active Directory organizational unit (OU) named “finance.” 2. Import the financePersonnel.csv file (found...
n this lab, you use what you have learned about parallel arrays to complete a partially...
n this lab, you use what you have learned about parallel arrays to complete a partially completed C++ program. The program should: Either print the name and price for a coffee add-in from the Jumpin’ Jive Coffee Shop Or it should print the message Sorry, we do not carry that. Read the problem description carefully before you begin. The file provided for this lab includes the necessary variable declarations and input statements. You need to write the part of the...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in Lab 2 to obtain a diameter value from the user and compute the volume of a sphere (we assumed that to be the shape of a balloon) in a new program, and implement the following restriction on the user’s input: the user should enter a value for the diameter which is at least 8 inches but not larger than 60 inches. Using an if-else...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code...
Complete a Java program named ARMgr that maintains customer accounts receivable in a database. The code to initialize the CustomerAccountsDB database table and add a set of customer accounts is provided. Finish the code in these 3 methods in CustomerAccountDB.java to update or query the database: -purchase(double amountOfPurchase) -payment(double amountOfPayment) -getCustomerName() Hint: For getCustomerName(), look at the getAccountBalance() method to see an example of querying data from the database. For the purchase() and payment() methods, look at the addCustomerAccount() method...
You will write a program that loops until the user selects 0 to exit. In the...
You will write a program that loops until the user selects 0 to exit. In the loop the user interactively selects a menu choice to compress or decompress a file. There are three menu options: Option 0: allows the user to exit the program. Option 1: allows the user to compress the specified input file and store the result in an output file. Option 2: allows the user to decompress the specified input file and store the result in an...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT