B
B
BonBon Slick2021-06-16 14:48:23
SQL
BonBon Slick, 2021-06-16 14:48:23

How to return a list of all first user actions sorted by date?

I failed this task, the time for solving 11 minutes after opening the spoiler.
Any tool can be used.
A little preface, the query will most likely have a subquery where there will be LIMIT(1) + GROUP BY player.id + ORDER BY created_at ASC

spoiler

In this task you are given a set of transactions. There are multiple requirements for which you need to write queries.
Results of queries must contain the requested columns with names used as column names and nothing else.
You have 2 tables:
player (id, transaction FK) // CREATE TABLE IF NOT EXISTS player ...
transaction (id INT, type STING, amount INT, created_at DATE) CREATE TABLE IF NOT EXISTS transaction ...
Create a query that returns list with first deposits of each player in ascending order by transaction creation date.
Deposit is a transaction with type = "deposit" .
List must have following columns:
name => transaction.type
week_day => week day names like "Monday"
count => transaction count


In fact, it can be, for example, Posts, Comments and other actions

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question