Write a query to list the title and price of all items

Assignment Help Database Management System
Reference no: EM131081975

Retrieving Data From Multiple Tables

First, make sure to make any necessary revisions to your logical model based on Task 1 feedback. Using MySQL, write the statements to develop a physical model of your database by creating the tables and constraints based on your Task 1 logical model. Be sure to use your ERD and data dictionary and create all constraints appropriately.

Once your tables are created, you will populate them with data using MySQL statements to insert records into the database. You should insert a minimum of five records into each table and more where necessary to ensure that the data in the database is sufficient to allow for each of your reports to be tested.

The result will be a script file that includes statements to

• DROP all tables;
• CREATE all tables with constraints;
• INSERT data into all tables; and
• SELECT data from all tables to show the data in each table.

Name this file yourname_task2.txt.

Also create a Word document that shows the structure of each table and the data in each of your tables (copy and paste from MySQL). Name this file yourname_tables.docx.

Note that your deliverables each week include any revisions to a previous task.

Submit your Task 2 deliverable as a zip file including the following.

• Task 0 proposal (with any revisions)
• Your Task 1 ERD (with any revisions)
• Your Task 1 DD (with any revisions)
• Your Task 2 script file to create and populate tables (yourname_task2.txt)
• A Word document showing all tables and data (yourname_tables.docx)

Lab: Joining Tables

LAB OVERVIEW

Scenario and Summary

Lab 5 will introduce the concept of multi-table JOINS in order to work with data in two or more related tables simultaneously.This lab may be completed using either DeVry's Omnymbus EDUPE-APP lab environment, or a local copy of the MySQL database running on your own computer using the OM database tables. The lab will utilize a set of tables that are represented by the ERD (OM_ERD.docx) and are created and populated by the script file (create_OM_db.sql). Follow the instructions in the file CreateOMTables.docx to create your database, tables, and data.

A few IMPORTANT things to note if using EDUPE MySQL:

**There can be NO SPACES in alias names given to a column. For example:

Select unit_price as "Retail Price " from items; --this does NOT work in EDUPE MySQL.
Any of the following WILL WORK:
Select unit_price as "RetailPrice" from items;
Select unit_price as "Retail_Price" from items;
Select unit_price as Retail_Price from items;
Select unit_price as RetailPrice from items;

**Any calculated fields MUST be given an alias (and note above NO SPACES in alias). For example:
selectunit_price * 2 from items; --this does NOT work in EDUPE MySQL
This will work:
selectunit_price * 2 as NewPricefrom items;

Deliverables

• Lab Report (Answer Sheet) containing both the student-created SQL command(s) for each exercise, and the output showing the results obtained. Be sure your name is on the file.

LAB STEPS: Complete each of the exercises below:

1. Use the JOIN ON syntax to write a query to display the order id, order date, customer name formatted as a single field (i.e. "Tom Jones")with a heading ofCustomer, and customer_city for customers residing in the state of OHIO. Sort the output to display the newest orders first.

2. Use the JOIN USING syntax to display the order_id, order date, and shipdate for orders to Karina Lacy that have shipped.

3. Use the implicit join syntax (the WHERE clause) to display the last name, city, order date and ship date for all orders shipped in 2012.

4.Use any join syntax EXCEPT NATURAL JOIN to list the customer_first_name and customer_last_name concatenated with an intervening space as Customer, customer city and state formatted as a single column in the format of "city, ST" with a heading of Location, order_id and order date for orders that have not shipped.

5. List the customer name, order date, zipcode for any customer(s) placing an order for the item titled ‘Etcetera".

6. Write a query to list the title and artist of ONLY the items that have been ordered. Only list each title once.

7. Write a query to list the title and price of all items that have been ordered by customer Millerton.

8. Write a query to list thelast name and order id of customers that ordered any items by the artist Burt Ruggles?

9. Write a query to display a list of titles along with the artist name., sorted by artist name.

10. Write a query to display an invoice for order 693 including the title, quanty, price, and a calculated column to display the line item subtotal (quantity times price) with a heading of Subtotal.

11. Display the order id, last name, title , and quantity for any items where customers have ordered 2 or more of a particular item in an order.

12. The employees table contains a list of employees of a company. An employee may be managed by another employee. To denote an employee's manager, the employee_id of the manager is entered into the manager_id field of the employee reporting to that manager. In order to produce a list of which managers supervise which employees, the table may be joined to itself using these two attributes (employee_id, manager_id). This is known as a SELF-JOIN. Use a SELF-JOIN on the employees table to produce a result containing two columns: the concatenated last_name and first_name of the manager, and the concatenated last_name and first_name of the employee. Label the first-column supervisor, and the second-column employee. Order the output by the supervisor's last_name and first_name.

13. Write a query to display the order id, order date, ship date, and customer last name for all SHIPPED orders placed on the internet (no employee id). Show the most recently shipped orders first.

14. Write a query that displays the order id, order date, and employee name as a single field labeled Employee for each order that an employee assisted with.

15. Write a query that displays the order id, order date, customer name as a single field labeled Customer for all orders for the sales rep Thomas Hardy, sorted by customer last name.

Attachment:- Createomtables.rar

Reference no: EM131081975

Questions Cloud

Determine the exact value of sin : Given that angle M is in the first quadrant such that sinM= 3/5, and angle Q is in the second quadrant such that sinQ= 12/13, determine the exact value of sin (M+Q).
What is the sample space of the experiment : What is the sample space of the experiment?
Is this scene entertaining or interesting : What action is happening? Is the scene funny? Who are the characters? Is this scene entertaining or interesting?
Find out the birthday of a randomly chosen person : Find out the birthday of a randomly chosen person
Write a query to list the title and price of all items : Write a query to list the title and price of all items that have been ordered by customer Millerton. Write a query to list thelast name and order id of customers that ordered any items by the artist Burt Ruggles?
What is the probability of each sample outcome : What is the probability of each sample outcome?
Continuous exponential growth model : Suppose that the number of bacteria in a certain population increases according to a continuous exponential growth model. A sample of 2400 bacteria selected from this population reached the size of 2751 bacteria in three hours. Find the hourly g..
What is the probability that the first card is a heart : What is the probability that the first card is a heart?
Exponential function showing the relationship : Let t be the number of hours since the start of the study. Let y be the number of bacteria cells. Write an exponential function showing the relationship between y and t.

Reviews

Write a Review

Database Management System Questions & Answers

  Provide a dynamic view of your supply chain

In your role as the database administrator for X-Tex, a small but successful company that designs and manufactures high tech fabrics, you have been asked to help optimize a query that will provide a dynamic view of your supply chain

  Relational and logical operators to evaluate logical

Boolean w6 using Relational and Logical Operators to Evaluate Logical (Boolean) Expression Evaluate the logical (Boolean) expressions in the following exercises and circle the correct answer after you evaluation

  How much factory supervision and indirect factory labor cost

How much factory supervision and indirect factory labor cost would be assigned to the Batch Set-Up activity cost pool and how much factory supervision and indirect factory labor cost would NOT be assigned to products using the activity-based costing..

  Create the database that contains each of the relations

Find all Governors General of Australia who were Barons at the time of their appointment. List them by Title and name and date that they were appointed to the position. Order the list by ascending date of appointment.

  Explain user activity monitoring

In this lab, you will save user activity data in a database. A record of each user's IP address and the current date and time will be created whenever a user visits the Personnel form.

  Contrast unstructured and structured data

Reflect on the textbook readings. Use examples to compare and contrast unstructured and structured data. Which type is more prevalent in a typical business environment

  1- prove that any relation schema with two attributes is in

1- prove that any relation schema with two attributes is in bcnf.nbsp2- ra b c is a relation in bcnf. a is one of the

  Program that performs mathematical operations

Create a batch file program that performs 4 mathematical operations such as addition, subtraction, multiplication and division.

  Consider the following database that contains information

consider the following database that contains information about people vacation locations and when those people visited

  Measurement of two lengths in feet and inches

"create a form with textboxes to enter the measurement of two lengths in feet and inches as integer values and compute the total length in feet and inches. For example, the total length of 5 feet 8 inches and 4 feet 6 inches is 10 feet 2 inches; a..

  Prove that your algorithm correctly computes the attribute

Describe a linear-time (in the size of the set of FDs, where the size of each FD is the number of attributes involved) algorithm for ?ndingthe attribute closure of a set of attributes with respect to a set of FDs

  Draw inheritance hierarchy to represent shoe object

Draw an inheritance hierarchy to represent a shoe object. The base class should have derived classes of Dress Shoes, Tennis Shoes and Boots.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd