Introduction to BigQuery
Matt Forrest
Field CTO
A simple query in BigQuery
-- Note the table name structure
SELECT
*
FROM
`project.ecommerce.order_items`
We can run queries in BigQuery via:
-- Using the full table name structure
SELECT
*
FROM
`project.ecommerce.ecomm_order_details`
/* Using the shorthand
table name structure */
SELECT
*
FROM
ecommerce.ecomm_order_details
product_id
- unique product IDproduct_photos_qty
- number of product photosproduct_weight_g
- weight of the productproduct_category_name_english
- product category nameorder_id
- Order unique IDorder_items
- STRUCT
containing information about the order itemsorder_item_id
- Item number in the order product_id
- Unique product IDseller_id
- Unique seller IDprice
- Price of the order itemorder_id
- unique order IDcustomer_id
- unique customer IDorder_status
- current order statusorder_purchase_timestamp
- Timestamp when order was purchasedorder_approved_at
- Timestamp when order was approvedorder_delivered_carrier_date
- Timestamp when order was accepted by the carrierorder_delivered_customer_date
- Timestamp when order deliveredorder_estimated_delivery_date
- Timestamp of estimated delivery dateorder_id
- unique order IDpayment_type
- type of paymentpayment_sequential
- payment numberpayment_installments
- number of payment installmentspayment_value
- value of that payment-- Count of orders per customers
SELECT
d.customer_id,
COUNT(o.order_id)
FROM
ecommerce.ecomm_order_details d
JOIN
ecommerce.ecomm_orders o
USING (order_id)
GROUP BY
d.customer_id
Five key components:
Introduction to BigQuery