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 | +------+
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
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:](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcbb74936-c73d-423e-b5c0-4a7ff906acfc%2F33368a57-2a3d-4084-8612-745b91e6c45b%2Fmht3jkd_processed.jpeg&w=3840&q=75)
![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 |
+------+](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcbb74936-c73d-423e-b5c0-4a7ff906acfc%2F33368a57-2a3d-4084-8612-745b91e6c45b%2F0ap3yx_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
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
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)