Sample queries
Last updated
Last updated
In this section, we provide several sample SQL queries to answer typical reporting needs like:
Additionally, in the following section, we provide .
To track which users actively engage with the platform, you can use as a proxy for activity and look at users who have recently earned XP.
The following query returns a list of all users that earned XP in the last 7 days.
In the query above, we specify the XP events to include. This is to avoid double counting XP in courses since the dataset contains course_engagement
and exercise_completed
events with a non-zero xp_earned
value. Both contain XP gained from completing an exercise, so including both would lead to double counting XP earned in courses.
You can also use the query above to identify your top learners for an XP competition. Simply modify the date filter to include the competition period.
Another common request is a list of the organization's users. The query below returns a list of all current members in your group and their start date.
You can include a restriction in the WHERE
clause if you would like to limit the results to a particular period.
If you want to see how different teams in your organization are taking advantage of our platform, we can modify the query above to look at the time spent per team in Learn content (assessments, courses, practices, and projects).
You can include a restriction in the WHERE
clause of the bottom section if you want to limit the results to a particular period.
You may be interested in reviewing the time each of your organization's users has spent learning on our platform. The following query returns each user's time spent in Learn content (assessments, courses, practices, and projects).
You can include a restriction in the WHERE
clause if you would like to limit the results to a particular period.
In the query above, we specify the XP events to include. This is to avoid double counting XP in courses since the dataset contains course_engagement
and exercise_completed
events with a non-zero xp_earned
value. Both contain XP gained from completing an exercise, so including both would lead to double counting XP earned in courses.
You can include a restriction in the WHERE
clause if you would like to limit the results to a particular period.
It is often necessary to review learning activity on a more granular level. A common question is, "What courses have our users completed?" The query below returns all courses completed by users in your organization.
You can include a restriction in the WHERE
clause if you would like to limit the results to a particular period.
Testing a user's skill level is an integral part of learning. If you want a report of all the assessments your organization's users have completed, the query below will tell you all complete assessments and their user, score, percentile, and completion date.
You can include a restriction in the WHERE
clause if you would like to limit the results to a particular period.
Please check the section for more details.
Each content type at DataCamp has an associated (e.g., R, Python, SQL, Spark, etc.). If you want to examine what technologies your users are most focused on, you can create a report with the time spent per technology with the query below.
A different way to look at engagement is to measure . You can track how active each of your organization's users has been on our platform with the query below that displays the total XP per user.
Please check the section for more details.