Breaking down customer transactions in SQL

Question

Given the following table containing customer transaction data:

Table name: orders

order_id channel date month revenue
0 1 Online 2018-09-01 09 100
1 2 Online 2018-09-03 09 125
2 3 In_store 2018-10-11 10 200
3 4 In_store 2018-08-21 08 80
4 5 Online 2018-08-13 08 200
5 6 Online 2018-10-29 10 100

Write SQL queries to answer the following:

  • Return all rows in the data table with transaction values over $101.
  • Return all rows in the data table with transaction values over $101 that were purchased through the Online channel.
  • Return all rows in the data table with transaction values that were either over $101 OR were purchased In_store.
  • Return the minimum transaction amount for both channels as well as the corresponding order id.

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now