Write a sql query to return all the employee details

Assignment Help PL-SQL Programming
Reference no: EM133095466

Scenario 1

Table Customers:(cust)

1165_Table Customers.jpg

Table Orders:(order)

1976_Table Orders.jpg

These two tables will be joined on the columns id (table customer) and Cust_id (Table Orders)

Question 1. Write a SQL query to get all the customer who had placed orders with aggregated total order cost and total order count.

Return below columns

• Cust.id

• Cust.first_name

• Cust.last_name

• Cust.state

• Total_order_cost

• Total_order_count

Question 2. Write a SQL query to get the list of customers who hadn't place any orders before.

Return below columns:

• Cust.id

• Cust.First_name

• Cust.Last_name

• Cust.Phone_number

Question 3. Write a SQL query to return Customer record with highest aggregated total_order_cost Return below columns:
• Cust.id

• Cust.First_name

• Cust.Last_name

Question 4. Write a SQL query to return Customer record with 2nd highest aggregated total_order_cost Return below columns:
• Cust.id

• Cust.First_name

• Cust.Last_name

Scenario 2

2395_Table Orders1.jpg

Note:

The employees table stores employee details. There will be a new record inserted whenever there is a
change in the employee's details.

Question 5. Write a SQL Query to return all the employee details with latest record.

Scenario 3

825_Table Orders2.jpg

Note:

The employees table stores employee's details. There are duplicated records captured in the table.

Question 6. Write a SQL Query to remove/delete the duplicate row and only keep one record per employee.

Reference no: EM133095466

Questions Cloud

Describe two quality management compliance requirements : Describe two quality management compliance requirements relating to organisational learning.
What amount of joint processing cost is allocated to product : Wan, Tu, Tri, Por Joint production costs are as follows: Materials - P4,000; Labor - P3,000; Overhead- P2,000. What amount of joint processing cost is allocated
Developing an organisational learning strategy : Identity and describe two organisational learning theories that can be used as a basis for developing an organisational learning strategy.
Case-converging or diverging : Read the case study titled "Converging or Diverging? A Comparative Analysis of Trends in Contingent Employment Practice in Europe over a Decade
Write a sql query to return all the employee details : Write a SQL Query to return all the employee details with latest record - Write a SQL query to return Customer record with highest aggregated total_order_cost
Improve the workplace by providing workforce : How can businessmen improve the workplace by providing workforce, improvement in productivity and investment of money along with ideas?
Organization about lessons learned and best practices : Inform others in the organization about lessons learned and best practices
Prepare the entry to record depreciation : Peter M. Dell Co. purchased equipment for $510,000 which was estimated to have a useful life of 10 years. Prepare the entry to record depreciation
What is the payback period for the new machine : Management predicts that the machine can produce sales of $198,000 each year for the next 5 years. What is the payback period for the new machine

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Write sql queries

Write a query to display the last name, department number, and salary of any employee whose department number and salary both match the department number and salary of any employee who earns a commission.

  Explaining sql insert statement to insert new row in cds

Write down a SQL insert statement to insert new row in "CDS" table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

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