From 83395eb17905917d65f774c2cb09d5f1065ffe72 Mon Sep 17 00:00:00 2001 From: lee Date: Wed, 5 Jan 2022 14:19:45 +0000 Subject: [PATCH] adding description for each query --- docs/db/sql.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/db/sql.md b/docs/db/sql.md index d711e43f3..5c212d2c1 100644 --- a/docs/db/sql.md +++ b/docs/db/sql.md @@ -1,9 +1,10 @@ ## Example of SQL queries -### sign up export +### sign up + +The following query returns the users that are currently in the sign up process. ```sql --- query for **SINGUP** SELECT DISTINCT u.id, u."githubLogin", @@ -17,7 +18,9 @@ WHERE u.id NOT IN (SELECT "userId" FROM public.user_role) AND u.id NOT IN (SELECT "userId" FROM public.progress p WHERE p."userId"=u.id); ``` -### Toad export +### Toad + +The following query returns the users that are currently in the toad process. The information includes user and games info ```sql -- query for **TOAD** @@ -50,7 +53,9 @@ AND r.attrs ->> 'games' IS NOT NULL ORDER BY r.attrs ->> 'score' ASC; ``` -### Administration export +### Administration + +The following query returns the users currently in the administration process. All information about the user, the number of attempts and current phase. ```sql -- query for **administration** @@ -97,9 +102,9 @@ GROUP BY u.id, r.attrs; ### xp per user per activity +The following query returns the amount of xp per user and per activity ```sql --- user | xp | last activity : with parent association, "this may be stupid to put the path alrady as the parent!" WITH xp_user AS ( SELECT u."githubLogin", @@ -122,6 +127,8 @@ LEFT JOIN public.event e ON e.id=xu."eventParentId"; ### user per xp +The following query returns the amount of xp per user + ```sql -- user per xp SELECT @@ -147,6 +154,8 @@ ORDER BY xp.amount DESC; ### group status +The following query returns the groups status per captain + ```sql -- group status SELECT @@ -160,6 +169,8 @@ ORDER BY u."githubLogin" ASC; ### group progresses +The following query returns the progress per group + ```sql -- group progresses WITH progress_group AS (