summaryrefslogtreecommitdiff
path: root/query.sql
diff options
context:
space:
mode:
Diffstat (limited to 'query.sql')
-rw-r--r--query.sql35
1 files changed, 35 insertions, 0 deletions
diff --git a/query.sql b/query.sql
new file mode 100644
index 0000000..f1f28e9
--- /dev/null
+++ b/query.sql
@@ -0,0 +1,35 @@
+-- query every anime with recent score
+select
+ title_pref, score
+from anime
+join stats on stats.id =
+ (
+ select
+ id
+ from stats
+ where
+ anime.mal_id = stats.mal_id
+ order by created_at desc limit 1
+ )
+order by title_pref, score desc;
+
+-- query historic stats for one anime
+select
+ title_pref,
+ anime_type,
+ score,
+ popularity,
+ members,
+ (watching+completed+onhold+dropped) as members_watching,
+ plan_to_watch,
+ favorites,
+ season_name,
+ season_year,
+ stats.created_at
+from anime
+join stats on
+ anime.mal_id = stats.mal_id
+where
+ anime.mal_id = 38883
+order by stats.created_at;
+