Input: SalesPerson table: ----+- +------ I sales_id | name | salary | commission_rate | hire_date ----- | 1 | 2 | 3 | John | 100000 | 6 | 12000 | Mark | 65000 | 25000 | Alex | 5000 | 5 | 12 | 25 | 10 | 4/1/2006 | 5/1/2010 | 12/25/2008 | | 1/1/2005 | 2/3/2007 | Amy | Pam | 5 +- Company table: +- | com id | name city +- | 1 | 2 | 3 | 4 | RED | ORANGE | New York| | YELLOW | Boston | GREEN | Boston | Austin +-- Orders table: +- | order id | order date | com id | sales id | amount | | 1 | 2 | 3 | 1/1/2014 | 2/1/2014 | 3/1/2014 | 4/1/2014 | 3 | 4 | 1 | 1 | 10000 | 5000 | 50000 | 25000 | 5 | 1 4 4 Write an SQL query to report the names of all the salespersons who did not have any orders related to the company with the name "RED". Return the result table in any order. The results should be: Output: +---- I name | +------+ | Amy | Mark | | Alex | +------+

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter6: Additional Database Objects
Section: Chapter Questions
Problem 6HOA: A new table has been requested to support tracking automated emails sent to customers. Create the...
icon
Related questions
icon
Concept explainers
Question

Write a clear full sql query please

Create the following table in your database with the following schema:
Table: SalesPerson
| Column Name
| Туре
+---
| sales id
| int
| varchar |
| int
I name
| salary
| commission_rate | int
| hire_date
I date
+----
----+
sales_id is the primary key column
Each row of this table indicates the name and the ID of a salesperson
alongside their salary, commission rate, and hire date.
this table.
Table: Company
| Column Name | Type
| int
| varchar I
| varchar |
| com_id
| name
| city
-----+
com_id is the primary key column for this table.
Each row of this table indicates the name and the ID of a company and the
city in which the company is located.
Table: Orders
| Column Name | Type |
+-
| order id
| order date
| com id
| sales id
| int
| date |
| int
| int
| int
| amount
+----
-----+
order id is the primary key column for this table.
com id is a foreign key to com id from the Company table.
sales id is a foreign key to com id from the SalesPerson table.
Each row of this table contains information about one order. This includes
the ID of the company, the ID of the salesperson, the date of the order, and
the amount paid.
Add the following data to your tables:
Transcribed Image Text:Create the following table in your database with the following schema: Table: SalesPerson | Column Name | Туре +--- | sales id | int | varchar | | int I name | salary | commission_rate | int | hire_date I date +---- ----+ sales_id is the primary key column Each row of this table indicates the name and the ID of a salesperson alongside their salary, commission rate, and hire date. this table. Table: Company | Column Name | Type | int | varchar I | varchar | | com_id | name | city -----+ com_id is the primary key column for this table. Each row of this table indicates the name and the ID of a company and the city in which the company is located. Table: Orders | Column Name | Type | +- | order id | order date | com id | sales id | int | date | | int | int | int | amount +---- -----+ order id is the primary key column for this table. com id is a foreign key to com id from the Company table. sales id is a foreign key to com id from the SalesPerson table. Each row of this table contains information about one order. This includes the ID of the company, the ID of the salesperson, the date of the order, and the amount paid. Add the following data to your tables:
Input:
SalesPerson table:
+----------
| sales id | name | salary | commission rate | hire date
| 1
| 2
| 3
| 4
| 5
| John | 100000 | 6
| 12000
| Mark | 65000
| 25000
| Alex | 5000
| 5
| 12
| 25
| 10
| 4/1/2006
| 5/1/2010
| 12/25/2008 I
| 1/1/2005
| 2/3/2007
| Amy
| Pam
+---
Company table:
+---
com_id | name
| city
| 1
| 2
| 3
| 4
| RED
| ORANGE | New York |
| YELLOW | Boston
| GREEN
| Boston
| Austin
+--
Orders table:
+---------
| order id | order date | com id | sales id | amount |
+--
-------+
| 1
| 2
| 3
| 4
| 1/1/2014
| 2/1/2014
| 3/1/2014
| 4/1/2014
| 3
| 4
| 1
| 1
| 4
| 5
| 1
| 4
| 10000
| 5000
| 50000
| 25000
Write an SQL query to report the names of all the salespersons who did not have any orders related
to the company with the name "RED".
Return the result table in any order.
The results should be:
Output:
+----
| name |
+------+
| Amy
| Mark |
| Alex |
+------+
Transcribed Image Text:Input: SalesPerson table: +---------- | sales id | name | salary | commission rate | hire date | 1 | 2 | 3 | 4 | 5 | John | 100000 | 6 | 12000 | Mark | 65000 | 25000 | Alex | 5000 | 5 | 12 | 25 | 10 | 4/1/2006 | 5/1/2010 | 12/25/2008 I | 1/1/2005 | 2/3/2007 | Amy | Pam +--- Company table: +--- com_id | name | city | 1 | 2 | 3 | 4 | RED | ORANGE | New York | | YELLOW | Boston | GREEN | Boston | Austin +-- Orders table: +--------- | order id | order date | com id | sales id | amount | +-- -------+ | 1 | 2 | 3 | 4 | 1/1/2014 | 2/1/2014 | 3/1/2014 | 4/1/2014 | 3 | 4 | 1 | 1 | 4 | 5 | 1 | 4 | 10000 | 5000 | 50000 | 25000 Write an SQL query to report the names of all the salespersons who did not have any orders related to the company with the name "RED". Return the result table in any order. The results should be: Output: +---- | name | +------+ | Amy | Mark | | Alex | +------+
Expert Solution
Step 1

Select name from salesPerson join orders on salesperson.sales_id=orders.sales_id where (select com_id from orders join company on orders.com_id=company.com_id where name !="RED")

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr