This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MediatR; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.Infrastructure; | |
using System.ComponentModel.DataAnnotations; | |
namespace SlimController.Controllers | |
{ | |
[ApiController] | |
[Route("[controller]")] | |
public class WeatherForecastController : ControllerBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#remove old output fiile | |
outputFile="$1.md" | |
rm -f outputFile | |
#SQLite3 commands | |
cmd=$({ grep -v '^#' <<EOF | |
.headers on | |
.mode csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
company_name | sale_date | total_amount | day_rank | company_id | |
---|---|---|---|---|---|
Company A | 2017–07–02 | 900 | 1 | 1 | |
Company A | 2018–03–01 | 500 | 2 | 1 | |
Company A | 2018–03–03 | 100 | 3 | 1 | |
Company B | 2018–03–03 | 1000 | 1 | 2 | |
Company B | 2017–09–15 | 700 | 2 | 2 | |
Company B | 2017–12–01 | 650 | 3 | 2 | |
Company B | 2017–06–10 | 560 | 4 | 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
company_name, | |
sale_date, | |
total_amount, | |
@rank := IF( @comp_id = company_id, @rank + 1, 1) AS day_rank, | |
@comp_id := company_id AS company_id | |
FROM | |
company_sales | |
ORDER BY | |
company_id, total_amount DESC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @rank = 0; | |
SELECT | |
company_name, | |
sale_date, | |
total_amount, | |
day_rank | |
FROM ( | |
SELECT | |
company_name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
company_name | sale_date | total_amount | day_rank | |
---|---|---|---|---|
Company A | 2017–07–02 | 900.00 | 1 | |
Company A | 2018–03–01 | 500.00 | 2 | |
Company A | 2018–03–03 | 100.00 | 3 | |
Company B | 2018–03–03 | 1000.00 | 1 | |
Company B | 2017–09–15 | 700.00 | 2 | |
Company B | 2017–12–01 | 650.00 | 3 | |
Company B | 2017–06–10 | 560.00 | 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
company_id | company_name | sale_date | total_amount | |
---|---|---|---|---|
1 | Company A | 2018–03–01 | 500.00 | |
2 | Company B | 2017–09–15 | 700.00 | |
1 | Company A | 2017–07–02 | 900.00 | |
2 | Company B | 2017–06–10 | 560.00 | |
2 | Company B | 2018–03–03 | 1000.00 | |
1 | Company A | 2018–03–03 | 100.00 | |
2 | Company B | 2017–12–01 | 650.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
company_name, | |
sale_date, | |
total_amount, | |
ROW_NUMBER() OVER(PARTITION BY company_id ORDER BY total_amount DESC) AS day_rank | |
FROM | |
company_sales |