> For the complete documentation index, see [llms.txt](https://dshub.gitbook.io/ds-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dshub.gitbook.io/ds-hub/sql/sql-practice/popular-websites-for-sql-practice/hackerrank/sql-advanced/15-days-of-learning-sql.md).

# 15 Days of Learning SQL

Advanced JOIN

[Question Link](https://www.hackerrank.com/challenges/15-days-of-learning-sql/problem?isFullScreen=false)

Julia conducted a 15 days of learning SQL contest. The start date of the contest was *March 01, 2016* and the end date was *March 15, 2016*.&#x20;

Write a query to print total number of unique hackers who made at least **1** submission each day (starting on the first day of the contest), and find the *hacker\_id* and *name* of the hacker who made maximum number of submissions each day. If more than one such hacker has a maximum number of submissions, print the lowest *hacker\_id*. The query should print this information for each day of the contest, sorted by the date.

***

**Input Format**

The following tables hold contest data:

* *Hackers:* The *hacker\_id* is the id of the hacker, and *name* is the name of the hacker.![](https://s3.amazonaws.com/hr-challenge-images/19597/1458511164-12adec3b8b-ScreenShot2016-03-21at3.26.47AM.png)
* *Submissions:* The *submission\_date* is the date of the submission, *submission\_id* is the id of the submission, *hacker\_id* is the id of the hacker who made the submission, and *score* is the score of the submission.

&#x20;![](https://s3.amazonaws.com/hr-challenge-images/19597/1458511251-0b534030b9-ScreenShot2016-03-21at3.26.56AM.png)

**Sample Input**

For the following sample input, assume that the end date of the contest was *March 06, 2016*.

*Hackers* Table: ![](https://s3.amazonaws.com/hr-challenge-images/19597/1458511957-814a2c7bf2-ScreenShot2016-03-21at3.27.06AM.png)&#x20;

*Submissions* Table: ![](https://s3.amazonaws.com/hr-challenge-images/19597/1458512015-ff6a708164-ScreenShot2016-03-21at3.27.21AM.png)

**Sample Output**

```
2016-03-01 4 20703 Angela
2016-03-02 2 79722 Michael
2016-03-03 2 20703 Angela
2016-03-04 2 20703 Angela
2016-03-05 1 36396 Frank
2016-03-06 1 20703 Angela
```

**Explanation**

On *March 01, 2016* hackers **20703**, **36396**, **53473**, and **79722** made submissions. There are 4 unique hackers who made at least one submission each day. As each hacker made one submission, **20703** is considered to be the hacker who made maximum number of submissions on this day. The name of the hacker is *Angela*.

On *March 02, 2016* hackers **15758**, **20703** , and **79722**  made submissions. Now  **20703** and  **79722** were the only ones to submit every day, so there are **2** unique hackers who made at least one submission each day.  **79722** made **2** submissions, and name of the hacker is *Michael*.

On *March 03, 2016* hackers **20703**, **36396**, and **79722** made submissions. Now  **20703** and **79722** were the only ones, so there are **2** unique hackers who made at least one submission each day. As each hacker made one submission so **20703** is considered to be the hacker who made maximum number of submissions on this day. The name of the hacker is *Angela*.

On *March 04, 2016* hackers **20703**, **44065**, **53473**,  and **79722** made submissions. Now **20703** and **79722** only submitted each day, so there are **2** unique hackers who made at least one submission each day. As each hacker made one submission so **20703**  is considered to be the hacker who made maximum number of submissions on this day. The name of the hacker is *Angela*. So on.

```sql




```
