Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the following questions from 1-10 to be sloved using SQL and should be tested in R the data tables are below. Query used

I need the following questions from 1-10 to be sloved using SQL and should be tested in R

the data tables are below. Query used in R to solve the question. Query will be tested in R so make sure you do not have any errors in your query.

You become a CEO of some company. To celebrate it, you throw a lunch party and take all the employees with you. Now answer the following questions to collect information about this lunch.

1-Four employees hila, stewart, tim and chris lives in California. List all the employees with additional column called CALIFORNIA and put Yes if the employee lives in California, otherwise put No in the column.

2- Using the same scenario of part 5, sort the CALIFORNIA in descending order, FIRSTNAME in ascending order (ascending is default)

3- Find who is ordering items less than 10 dollars, sorted by lowest cost. (Join Employees and Orders table and include id, item, item_cost, first name and last name in the output table)

4- All the items are priced by quantity. Calculate the total price and figure out who spent less than $20. Use alias TOTAL_PRICE for new column. Include id, item, quantity_ordered, item_cost, first name, last name and total_price in the output table

5- We want to keep track of food consumption per person, particularly who is eating less than average on a cost basis? This requires a #Subquery to first determine the average lunch cost and then passing that value to the HAVING clause #Subquery: returns a single value for the average lunch cost for employees (those with valid ID)

image text in transcribed

image text in transcribed

please answer all part of the question !!

LASTNAME FIRSTNAME GENDER 2 t 3 S 4 w 5 h 6 Z jason hila lashanda f stewart 8 r 9 o 10 anza eric michelle f 13 14 15 16 17 18 19 12 c 13 p 14 o 15 i 16 b 17 f 18 S 19 a 20 p chris michael dima drew m michelle f jason 21 LASTNAME FIRSTNAME GENDER 2 t 3 S 4 w 5 h 6 Z jason hila lashanda f stewart 8 r 9 o 10 anza eric michelle f 13 14 15 16 17 18 19 12 c 13 p 14 o 15 i 16 b 17 f 18 S 19 a 20 p chris michael dima drew m michelle f jason 21

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions