-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathExample-Queries
39 lines (24 loc) · 1.14 KB
/
Example-Queries
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Example queries for Google BigQuery: https://console.cloud.google.com/iam-admin/iam/project?project=bigquery-158617
SELECT Passenger_count, Pickup_longitude, Pickup_latitude
FROM [TaxiTrips.example_table]
SELECT *
FROM [TaxiTrips.example_table]
SELECT Passenger_count, Pickup_longitude, Pickup_latitude
FROM [TaxiTrips.example_table]
WHERE Pickup_longitude > -74 AND Pickup_latitude < 40.75
SELECT Passenger_count, COUNT(*) AS number_of_trip, AVG(Total_amount) AS average_fare
FROM [TaxiTrips.example_table]
GROUP BY Passenger_count
SELECT Pickup_longitude AS lon, Pickup_latitude AS lat
FROM [TaxiTrips.example_table]
SELECT Passenger_count, AVG(Total_amount) as avg_fare, COUNT(*) as trips
FROM [TaxiTrips.example_table]
GROUP BY Passenger_count
SELECT ROUND(pickup_latitude, 4) as lat, ROUND(pickup_longitude, 4) as lon, COUNT(*) as num_pickups
FROM [TaxiTrips.yellow_taxi_jun]
GROUP BY lat, lon
SELECT *
FROM [TaxiTrips.example_table_copy]
LEFT JOIN [TaxiTrips.surcharge]
ON TaxiTrips.example_table_copy.Passenger_count = TaxiTrips.surcharge.Passenger_count
WHERE TaxiTrips.example_table_copy.Pickup_longitude < 75 AND TaxiTrips.surcharge.surcharge > 2