Question

Create a view that will list the order number, order date, part number, part description, and...

Create a view that will list the order number, order date, part number, part description, and item class for each part that makes up the order from the TAL database.

TAL Database:

Table_Name Column Name Column Type Column Length Nullable Key
Orders Order_Num Character 5 No Primary
orders order_date Date Yes
Orders Customer_num Character 3 Yes Foreign
Order_Line Order_Num Character 5 No Primary
Order_Line Part_Num Character 4 No Primary
Order_Line Num_Ordered Number 3,0 Yes
Order_Line Quoted_Price Number 6,2 Yes
Part part_num Character 4 No Primary
Part Description Character 150 Yes
Part on_hand Number 4,0 Yes
Part class character 2 Yes
Part warehouse character 1 Yes
Part price number 6.2 Yes
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Views are created by using the syntax given below:

CREATE VIEW view_name AS statement;

The following select statement you use to query your results.

SELECT o.Order_Num, o.order_date, p.part_num, p.Description, p.class

FROM Part p

JOIN Order_Line ol ON p.part_num=ol.part_num

JOIN Orders o ON o.Order_num=ol.Order_Num

The following sql statement creates view.

CREATE VIEW orderview

AS

SELECT o.Order_Num, o.order_date, p.part_num, p.Description, p.class

FROM Part p

JOIN Order_Line ol ON p.part_num=ol.part_num

JOIN Orders o ON o.Order_num=ol.Order_Num

Add a comment
Know the answer?
Add Answer to:
Create a view that will list the order number, order date, part number, part description, and...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please answer each question using these tables above, it is SQL Display the descriptions and prices of the 5 most expe...

    Please answer each question using these tables above, it is SQL Display the descriptions and prices of the 5 most expensive parts, in descending order by price. For each part, display the On Hand Value, which is calculated by multiplying the quantity on hand by price. Display a summary with part number, description, on hand and warehouse for all parts in class HW or AP, and in warehouse 1 or 2. Display the names of customers who do NOT live...

  • 8.Write the commands to obtain the following information from the systems catalog. List every table that...

    8.Write the commands to obtain the following information from the systems catalog. List every table that you own, list every column in the PART table and its associated data type, then add ORDER_NUM as a foreign key in the ORDER_LINE table. this is the SQL for the database: CREATE DATABASE PREMIERE; USE PREMIERE; CREATE TABLE REP (REP_NUM CHAR(2) PRIMARY KEY, LAST_NAME CHAR(15), FIRST_NAME CHAR(15), STREET CHAR(15), CITY CHAR(15), STATE CHAR(2), ZIP CHAR(5), COMMISSION DECIMAL(7,2), RATE DECIMAL(3,2) ); CREATE TABLE CUSTOMER...

  • Program: MYSQL (please show screenshots of the solution)  Ill give good rating! Define a view named TopLevelCust...

    Program: MYSQL (please show screenshots of the solution)  Ill give good rating! Define a view named TopLevelCust that consists of the number, name, address, balance and credit limit of all customers with credit limits that are greater than or equal to $5,000. Address is defined as street, city, state and zip. Concatenate these into one field named Address.   A. Type in your view construct here: B. Write a query to retrieve the number and name of all customers in the TopLevelCust...

  • Use the Premiere Products database (see Figure 1-2 in Chapter 1) to complete the following exercises....

    Use the Premiere Products database (see Figure 1-2 in Chapter 1) to complete the following exercises. If directed to do so by your instructor, use the information provided with the Chapter 3 Exercises to print your output. 1. List the part number and description for all parts. The part descriptions should appear in uppercase letters. 2. List the customer number and name for all customers located in the city of Grove.Your query should ignore case. For example, a customer with...

  • Answer the following questions using mysql. Please show screenshots to make sure the queries work...

    Answer the following questions using mysql. Please show screenshots to make sure the queries work. 1. Use a sub-query and the IN operator to find the number and name of each customer that placed an order on October 23, 2007. 2. Repeat step 2, but this time use the EXISTS operator in your answer. 3. Using a sub-query, find the number and name of each customer that did not place an order on October 23, 2007. 4. Using a sub-query,...

  • 1. Using a function, display the customer who has the highest credit limit. Display the customer...

    1. Using a function, display the customer who has the highest credit limit. Display the customer number, customer name, and credit limit. Insert your snip of the query and resultset together here: 2. How many customers have the same credit limit? Display the count of customers by credit limit. Display the count as ‘Number of Customers’ and credit limit as ‘Credit Limit’. Insert your snip of the query and resultset together here: 3. What is the average quoted price, maximum...

  • Using the Premier Products database answer the following questions 1. Using a union, display all customers...

    Using the Premier Products database answer the following questions 1. Using a union, display all customers that have rep number 65 or live in the town of Sheldon. Display all customer information. Insert your snip of the query and resultset together here: 2. Using a subquery, list the rep information for all customers who have the same credit limit as customer number 725. To receive credit for this question, do not explicitly query for rep number 35. Let MySQL do...

  • For each city, list number of customers from the city, who have placed order(s). Cities are...

    For each city, list number of customers from the city, who have placed order(s). Cities are listed in ascending alphabetical order. Use equal join for this query. CREATE TABLE customer ( cust_id number(11,0) not null, cust_name varchar2(25) not null, street varchar2(30), city varchar2(20), state varchar2(2), zipcode varchar2(5), CONSTRAINT customer_pk PRIMARY KEY (cust_id) ); CREATE TABLE ordertable ( order_id number(11,0) not null, order_date date, cust_id number(11,0), CONSTRAINT order_pk PRIMARY KEY (order_id), CONSTRAINT order_fk FOREIGN KEY (cust_id) REFERENCES customer (cust_id)); CREATE TABLE...

  • Sample data is provided for the database for the sales system. Using the sample data, you...

    Sample data is provided for the database for the sales system. Using the sample data, you will determine the entities, key components of the entities, and business rules for the entities. Using the entities and business rules you will then create an ERD. Tasks: 1. For each entity provide the name, description, fields, data type, primary key, and foreign key. 2. For each direct entity type pair, provide the business rules. 3. Provide the ERD. Customer Table Customer ID, Last...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT