Using the Online SQL Editor, answer the following questions with screenshots. Link: https://www.programiz.com/sql/online-compiler/ Customers customer_id first_name last_name age country 1 John Doe 31 USA 2 Robert Luna 22 USA 3 David Robinson 22 UK 4 John Reinhardt 25 UK 5 Betty Doe 28 UAE Orders order_id item amount customer_id 1 Keyboard 400 4 2 Mouse 300 4 3 Monitor 12000 3 4 Keyboard 400 1 5 Mousepad 250 2 Shippings shipping_id status customer 1 Pending 2 2 Pending 4 3 Delivered 3 4 Pending 5 5 Delivered 1 1. Join the Customer and Order Tables by presenting the last names and first names of customers while at the same time showing the number of orders (count) each person had; Rename the number of orders (count) column as order_count; then, group the results via last name. Answer(screenshot of code & output from SQL Editor) 2. Show country column as well as the number of times (count) each country has appeared in the Customers table; Rename the “number of times each country has appeared” (count) column as Country_count. Answer(screenshot of code & output from SQL Editor) 3. Join the Customer and Order Tables by showing all customers who have made orders in the Orders table; Present the customer ID, Last name, and first name columns in the result. Answer(screenshot of code & output from SQL Editor) 4. Show all the distinct countries (from Customers table) as well as all distinct amounts (from Orders table) in one column; rename column as country_amount. Answer(screenshot of code & output from SQL Editor)
Using the Online SQL Editor, answer the following questions with screenshots.
Link: https://www.programiz.com/sql/online-compiler/
Customers
customer_id | first_name | last_name | age | country |
---|---|---|---|---|
1 | John | Doe | 31 | USA |
2 | Robert | Luna | 22 | USA |
3 | David | Robinson | 22 | UK |
4 | John | Reinhardt | 25 | UK |
5 | Betty | Doe | 28 | UAE |
Orders
order_id | item | amount | customer_id |
---|---|---|---|
1 | Keyboard | 400 | 4 |
2 | Mouse | 300 | 4 |
3 | Monitor | 12000 | 3 |
4 | Keyboard | 400 | 1 |
5 | Mousepad | 250 | 2 |
Shippings
shipping_id | status | customer |
---|---|---|
1 | Pending | 2 |
2 | Pending | 4 |
3 | Delivered | 3 |
4 | Pending | 5 |
5 | Delivered | 1 |
1. Join the Customer and Order Tables by presenting the last names and first names of customers while at the same time showing the number of orders (count) each person had; Rename the number of orders (count) column as order_count; then, group the results via last name. Answer(screenshot of code & output from SQL Editor)
2. Show country column as well as the number of times (count) each country has appeared in the Customers table; Rename the “number of times each country has appeared” (count) column as Country_count. Answer(screenshot of code & output from SQL Editor)
3. Join the Customer and Order Tables by showing all customers who have made orders in the Orders table; Present the customer ID, Last name, and first name columns in the result. Answer(screenshot of code & output from SQL Editor)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 7 steps with 5 images
![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)