Created
September 25, 2020 01:15
-
-
Save ogabrielguerra/c8073aff6fb1c405f691a615693a5ed0 to your computer and use it in GitHub Desktop.
SQL Script - Course Manager Queries
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
-- COUNT APPLICATIONS BY USER | |
SELECT ca.id_user, u.name, | |
COUNT(ca.id_user) as num_applications | |
FROM course_application ca, user u | |
WHERE ca.id_user = u.id | |
GROUP BY ca.id_user, u.name; | |
-- COUNT COURSES BY USER OF ID 1 | |
SELECT ca.id, ca.id_user, ca.id_course, | |
c.title, u.name, u.email, ca.application_date | |
FROM course_application ca , course c, user u | |
WHERE ca.id_user = u.id | |
AND ca.id_course = c.id | |
AND ca.id_user = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment