Browse Source

correction

pull/916/head
Chris 2 years ago
parent
commit
603a4e82dc
  1. 22
      docs/db/sql.md

22
docs/db/sql.md

@ -5,21 +5,21 @@ This documentation is a quickstart guide for the use of metabase in a school ser
Pre-requisites: Pre-requisites:
- An access account given by your administrator. - An access account given by your administrator.
- A basic knowledge of SQL - A basic knowledge of SQL.
### Where to enter your SQL queries ### Where to enter your SQL queries
The path to metabase is {DOMAIN}/metabase The path to metabase is `{DOMAIN}/metabase` .
After loggin with valid credentials this is where you land, After loggin with valid credentials this is where you land,
In the bottom section `OUR DATA` In the bottom section `OUR DATA`.
- Click on the `metabase` database. - Click on the `metabase` database.
- A folder `public` should appear among others. Click on it. - A folder `public` should appear among others. Click on it.
At this point you can see all tables of the public sql database At this point you can see all tables of the public sql database.
To execute a query, simply click on the top right button `write SQL` To execute a query, simply click on the top right button `write SQL`.
Following are examples of SQL queries to help you get you started. Following are examples of SQL queries to help you get you started.
@ -49,8 +49,6 @@ The following query returns the users that are currently in the toad process. Th
```sql ```sql
-- query for **TOAD** -- query for **TOAD**
-- With g AS (SELECT r.attrs ->> 'games' as games, r."userId" FROM public.result r)
-- SELECT * FROM json_array_elements(g);
SELECT DISTINCT SELECT DISTINCT
u.id, u.id,
"githubLogin", "githubLogin",
@ -80,7 +78,7 @@ ORDER BY r.attrs ->> 'score' ASC;
### Administration ### Administration
The following query returns the users currently in the administration process. This includes all information about the user, the number of attempts and current phase. The following query returns the users currently in the administration process. This includes all information about the user, the number of attempts and the current phase.
```sql ```sql
-- query for **administration** -- query for **administration**
@ -125,7 +123,7 @@ AND u.id NOT IN (SELECT "userId" FROM public.user_role)
GROUP BY u.id, r.attrs; GROUP BY u.id, r.attrs;
``` ```
### xp per user per activity ### Xp per user per activity
The following query returns the amount of xp per user and per activity. The following query returns the amount of xp per user and per activity.
@ -150,7 +148,7 @@ FROM xp_user xu
LEFT JOIN public.event e ON e.id=xu."eventParentId"; LEFT JOIN public.event e ON e.id=xu."eventParentId";
``` ```
### user per xp ### Xp per user
The following query returns the amount of xp per user. The following query returns the amount of xp per user.
@ -177,7 +175,7 @@ WHERE u.id=xp."userId"
ORDER BY xp.amount DESC; ORDER BY xp.amount DESC;
``` ```
### group status ### Group status per captain
The following query returns the groups status per captain. The following query returns the groups status per captain.
@ -192,7 +190,7 @@ WHERE u.id=g."captainId"
ORDER BY u."githubLogin" ASC; ORDER BY u."githubLogin" ASC;
``` ```
### group progresses ### Group progresses
The following query returns the progress per group. The following query returns the progress per group.

Loading…
Cancel
Save