Skip to content

Instantly share code, notes, and snippets.

@celaus
Created October 3, 2016 14:21
Show Gist options
  • Save celaus/acdf6a90273e2739d96b908efd878b7a to your computer and use it in GitHub Desktop.
Save celaus/acdf6a90273e2739d96b908efd878b7a to your computer and use it in GitHub Desktop.
select avg(tip_amount) from "nyc-yellowcab" where tip_amount > 0;
select count(*), vendorid from "nyc-yellowcab" group by vendorid;
select avg(tip_amount), vendorid from "nyc-yellowcab" where tip_amount > 0 group by 2;
select avg(cast(passenger_count as integer)) from "nyc-yellowcab";
select passenger_count, avg(tip_amount) from "nyc-yellowcab" where tip_amount > 0 group by passenger_count order by 1;
select passenger_count, count(*) from "nyc-yellowcab" group by passenger_count order by 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment