• Involvierte Definitionen:
  • Veranstaltung:
  • Referenz: Einsendeaufgaben KE7

Beispiel: Queries in Cassandra

Sei folgende Modellierung gegeben:

In Cassandra können wir die folgenden Queries wie folgt lösen:

Anzahl Projekte pro Department

SELECT 
  department_name, count(project_id) as "numberOfProjects"
FROM 
  average_project_duration_by_department
GROUP BY
  department_id;

Durchschnittliche Dauer aller Projekte

SELECT 
  AVG((toUnixTimestamp(project_end) - toUnixTimestamp(project_start))/(1000*60*60*24)) as avgProjectDurationDays
FROM 
  average_project_duration_by_department;

Durchschnittliche Projektdauer des “Technology” Departments

SELECT 
  department_name, AVG((toUnixTimestamp(project_end) - toUnixTimestamp(project_start))/(1000*60*60*24)) as avgProjectDurationDays
FROM 
  average_project_duration_by_department
WHERE
  department_name = 'Technology' ALLOW FILTERING;

Satisfaction des “Technology” Departments

SELECT 
  department_name, AVG(CAST (employee_satisfaction as DOUBLE)) as avgSatisfaction
FROM 
  average_satisfaction_by_department
WHERE
  department_name = 'Technology';