Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The question is the image below, for which I must write an SQL query. below that is example output and the schema for the databases
The question is the image below, for which I must write an SQL query. below that is example output and the schema for the databases used
4 First/Last Values 4.1 How many days after the first hire of each department (restrict query only to marketing and purchasing departments) were the next employees in that respective department hired? EMPLOYEE ID DEPARTMENT ID DAY GAP 201 202 114 115 20 20 30 30 30 30 1113 30 1439 30 1707 0 547 162 960 116 118 119 8 rows selected HR LOCATIONS DEPARTMENTS department_id location_id postal_code state_province departmentnamestreet address manager_id location_id Cl JOB HISTORY employee_id start_date end, date country_id ; | EMPLOYEES employee id first name last_name email phone_number hire date job_id salary commission pct manager_id department id id COUNTRIES country_id country_name region_id department id JOBS job_id job title min_salary max_salary REGIONS region_id region_name OE CUSTOMERS ORDER ITEMS ORDERS order_id order_date customer_id cust first name cust last name cust _address phone_numbers nls_language nls_territory credit limit cust email account mgr id cust geo location date of birth marital_status gender income_level order_id line item idorder m product id unit_price quantity customer_id order_status order total sales_rep id promotion_id PRODUCT INFORMATION PRODUCT DESCRIPTIONS product id languagei translated name translated _description product_ id product name product description category_id weight_class warranty period supplier id product status list price min_price catalog unl WAREHOUSES warehouse_id ..A INVENTORIES ---warehouse spec product ic warehouse id quantity_on hand warehouse_name_ location_id wh_geo_location Description of "Figure 4-1 HR and OE Schemas" 4 First/Last Values 4.1 How many days after the first hire of each department (restrict query only to marketing and purchasing departments) were the next employees in that respective department hired? EMPLOYEE ID DEPARTMENT ID DAY GAP 201 202 114 115 20 20 30 30 30 30 1113 30 1439 30 1707 0 547 162 960 116 118 119 8 rows selected HR LOCATIONS DEPARTMENTS department_id location_id postal_code state_province departmentnamestreet address manager_id location_id Cl JOB HISTORY employee_id start_date end, date country_id ; | EMPLOYEES employee id first name last_name email phone_number hire date job_id salary commission pct manager_id department id id COUNTRIES country_id country_name region_id department id JOBS job_id job title min_salary max_salary REGIONS region_id region_name OE CUSTOMERS ORDER ITEMS ORDERS order_id order_date customer_id cust first name cust last name cust _address phone_numbers nls_language nls_territory credit limit cust email account mgr id cust geo location date of birth marital_status gender income_level order_id line item idorder m product id unit_price quantity customer_id order_status order total sales_rep id promotion_id PRODUCT INFORMATION PRODUCT DESCRIPTIONS product id languagei translated name translated _description product_ id product name product description category_id weight_class warranty period supplier id product status list price min_price catalog unl WAREHOUSES warehouse_id ..A INVENTORIES ---warehouse spec product ic warehouse id quantity_on hand warehouse_name_ location_id wh_geo_location Description of "Figure 4-1 HR and OE SchemasStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started