Back to problems

User Last Order Date and Order Count SQL Query

SQL · Netflix · Medium

Assume there are two tables: orders, containing order_id, user_id, and order_date, and users, containing user_id and name. Write an SQL query that lists every user's latest order date together with their total number of orders. Sort the resulting rows by the user's name. Input Format The orders and users tables. Output Format The user's name, most recent order date, and total order count. Example Given these rows: orders table: order_id user_id order_date 10 3 2023-03-02 11…

Checking your access…