Skip to content

Commit

Permalink
finish tutorial 2
Browse files Browse the repository at this point in the history
  • Loading branch information
erikaduan committed Feb 1, 2022
1 parent 1edcfcb commit 6af9ba2
Show file tree
Hide file tree
Showing 5 changed files with 664 additions and 83 deletions.
239 changes: 239 additions & 0 deletions figures/p-sql_to_r_workflows-prod_workflow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions tutorials/p-sql_to_r_workflows/hobbit_enrolments.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SELECT
s.student_id,
CONCAT(s.first_name, ' ', s.last_name) AS student_name,
c.course_id,
c.course_name,
ROW_NUMBER() OVER (PARTITION BY s.student_id ORDER BY e.start_date)
AS course_sequence,
e.start_date,
e.end_date

FROM education.enrolment AS e
INNER JOIN education.student AS s
ON e.student_id = s.student_id

INNER JOIN education.course as c
on e.course_id = c.course_id

WHERE start_date <= '2005-01-01'

ORDER BY student_id, start_date
20 changes: 20 additions & 0 deletions tutorials/p-sql_to_r_workflows/hobbit_enrolments_flex.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SELECT
s.student_id,
CONCAT(s.first_name, ' ', s.last_name) AS student_name,
c.course_id,
c.course_name,
ROW_NUMBER() OVER (PARTITION BY s.student_id ORDER BY e.start_date)
AS course_sequence,
e.start_date,
e.end_date

FROM education.enrolment AS e
INNER JOIN education.student AS s
ON e.student_id = s.student_id

INNER JOIN education.course as c
on e.course_id = c.course_id

WHERE start_date <= {before_date}

ORDER BY student_id, start_date
Loading

0 comments on commit 6af9ba2

Please sign in to comment.