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

  Recognize input data required for each of processes

Recognize input data required for each of processes. Recognize logical name for each data output item and kind of data output (real number, integer, text).

  Calculate canonical cover for set of functional dependencies

Calculate a canonical cover for above set of functional dependencies (show each step of your derivation with an explanation).

  Create series of different users-administering privileges

You will be creating a series of different users, administering various privileges to those users, and exploring how roles help provide additional functionality to the user picture.

  Assignmentwrite a assignment to study and modify the

assignmentwrite a assignment to study and modify the postgresql source code with a focus on one of the core modules -

  Determine the data types and additional column properties

For each entity in the E-R model, specify a table structure, determine the data types and additional column properties, identify primary keys and foreign keys, and verify normalization on the resulting tables.

  Create a database.

Create a database.

  How many cylinders does the disk have

Consider a disk with a sector size of 512 bytes, 2000 tracks per surface, 50 sectors per track, ?ve double-sided platters, and average seek time of 10 msec.

  Which object would you use to enter, delete, or modify data

Which object would you use to enter, delete, or modify data. Which object would you use to retrieve customers who live in Germany and the United States

  Oracle having multiple group functions in same select list

Can Oracle have multiple group functions in the same SELECT list of query (i.e can we do a COUNT and AVG)? Let us assume we wanted to find lowest, highest, average.

  Show the database development processes

Assume you were a newly hired IT Security Manager at a software development company that in the past hasn't paid much attention to security, especially in its database development processes.

  Define basic entity relationship diagram colleges

E-R diagram - Basic Entity Relationship Diagram Colleges and universities must draw a clear connection between the requirements of the field for which the student is being prepared and the things required of the student as part of that preparation pr..

  Default rules for enforcing referential integrity constraint

Explain how referential integrity actions can be used to override the default referential integrity constraints.

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