-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueries.sql
executable file
·37 lines (28 loc) · 957 Bytes
/
Queries.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*These will not work, need inner joins to work, some are implemented below original method*/
SELECT * FROM lists WHERE
listID=listRel.listID AND
listRel.userID=<input_user_ID_here>;
SELECT name FROM lists
INNER JOIN listRel ON lists.listID=listRel.listID
INNER JOIN users ON listRel.userID=users.userID
WHERE users.userID=2;
/*------------------------*/
SELECT name FROM lists WHERE
listID=listRel.listID AND
listRel.userID=<insert_user_ID_here>;
/*------------------------*/
SELECT val FROM items WHERE
items.listID=<insert_list_ID_here> AND
checked=false;
/*------------------------*/
SELECT val FROM items WHERE
items.listID=<insert_list_ID_here> AND
checked=true;
/*------------------------*/
SELECT COUNT(itemID) FROM items WHERE
items.listID = <insert_list_ID_here>;
/*------------------------*/
SELECT COUNT(itemID) FROM items WHERE
items.itemID + lsits.listID AND
lists.listID = listRel.listID AND
listRel.userID = <insert_user_ID_here>;