Icon

This is the documentation for an older version of Qube. The latest version of the documentation can be found here: Qube

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
mysql> SELECT
	COUNT(*) 
FROM 
	job_fact AS fact
INNER JOIN
	user_dim AS user
ON
	fact.user_sk = user.user_sk
INNER JOIN
	time_dim AS time
ON
	fact.time_sk=time.time_sk
WHERE
	user.name = 'jburk'
AND
	time.month = 1
AND 
	time.year = 2014
;
+----------+
| COUNT(*) |
+----------+
| 83       |
+----------+
Get a count of all jobs for each user for all of 2013:
Code Block
mysql> SELECT
user.name
, time.month_name
, COUNT(*) as "job count" 
FROM 
job_fact AS fact
INNER JOIN
user_dim AS user
ON
fact.user_sk = user.user_sk
INNER JOIN
time_dim AS time
ON
fact.time_sk=time.time_sk
WHERE
time.year = 2013
GROUP BY
user.name
, time.month
ORDER BY
user.name
, time.month
;
+---------------+------------+-----------+
| name          | month_name | job count |
+---------------+------------+-----------+
| Administrator | January    | 4         |
| bar           | July 		 | 1  	 	 |
| foo           | July 		 | 2 	 	 |
| foobar        | July 		 | 1 		 |
| foobar        | September  | 2 		 |
| fubar         | July		 | 1 		 |
| jburk         | March		 | 1 		 |
| jburk         | May		 | 123 		 |
| jburk         | June		 | 24 		 |
| jburk         | July		 | 220 		 |
| jburk         | August	 | 140 		 |
| jburk         | September	 | 68 		 |
| jburk         | October	 | 560 		 |
| jburk         | November	 | 59 		 |
| jburk         | December	 | 4467 	 |
| perforce 		| January	 | 128 		 |
| perforce 		| February	 | 4 		 |
| root 			| January	 | 31 		 |
| root 			| February	 | 37 		 |
| root 			| March		 | 7 		 |
| root 			| April		 | 17 		 |
| root 			| May		 | 7 		 |
| root 			| June		 | 1 		 |
| root 			| July		 | 11 		 |
| root 			| September	 | 2 		 |
| root 			| December	 | 2 		 | 
| shinya 		| January	 | 23 		 |
| shinya 		| February	 | 69 		 |
| shinya 		| March		 | 7 		 |
| shinya 		| April		 | 20 		 |
| shinya 		| May		 | 2 		 |
+---------------+------------+-----------+

...