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)

Trending now
This is a popular solution!
Step by step
Solved in 7 steps with 5 images









