it is an aggregating function. As such, it will calculate the standard deviation of the variable over the rows in the query result.
If you have a grouping value, it will aggregate over the rows for each grouping. Here are examples.
Sample Data:
create(:Employee{id:0,salary:45000,dept:"IT"}),(:Employee{id:1,salary:110000,dept:"IT"}),(:Employee{id:2,salary:75000,dept:"IT"}),(:Employee{id:3,salary:95000,dept:"HR"}),(:Employee{id:4,salary:225000,dept:"HR"}),(:Employee{id:5,salary:150000,dept:"FINANCE"}),(:Employee{id:6,salary:200000,dept:"FINANCE"}),(:Employee{id:7,salary:125000,dept:"FINANCE"})
Data:
Result of aggregating over the dept:
match(n:Employee)
return n.dept, n.salary
Result of aggregating over the entire company (no grouping):
match(n:Employee)
return stdev(n.salary)
This is how all the aggregation functions behave.