Back to Chapters
Chapter Progress: 0 %0 / 5 Lessons Read
β€Ί

1. Meet BigQuery: store big tables, ask with SQL

1.1 What is BigQuery?

Highlights & notes

Select lesson text to highlight it, or tap Add note.

    Bookmarks

    Bookmark a lesson to see it here.

      Think of a school with one lakh students. A paper register is far too slow to answer "how many students scored above 90?". BigQuery is Google Cloud's data warehouse: a place that stores very big tables and answers questions about them in seconds.

      • You write SQL. BigQuery does the heavy work.
      • It is serverless: there is no computer for you to buy, start or switch off.
      • It stores data column by column, so reading 2 columns of a 100-column table is quick.

      Data is kept in three levels, like a cupboard:

      • Project: the whole cupboard. The bill is per project.
      • Dataset: one shelf. It holds a group of tables.
      • Table: one file of rows and columns.

      The full name of a table is project.dataset.table, for example shop-prod.sales.orders.

      Excel vs BigQuery

      • An Excel sheet β†’ a table
      • A folder of sheets β†’ a dataset
      • Your whole laptop β†’ a project
      • Excel stops at about 10 lakh rows. BigQuery is happy with billions.
      Must Know:

      Write the dataset with the table: sales.orders, not just orders. Real projects have many datasets, and two of them can hold a table with the same name.

      Set up the practice tables

      Copy this once into the BigQuery editor and press Run. It makes two small tables you will use in every BigQuery lesson.

      SQL
      CREATE SCHEMA IF NOT EXISTS sales;
      
      CREATE OR REPLACE TABLE sales.customers AS
      SELECT * FROM UNNEST([
        STRUCT(1 AS customer_id, 'Asha' AS name, 'Noida' AS city),
        (2, 'Ravi', 'Delhi'),
        (3, 'Meera', 'Pune'),
        (4, 'Kabir', 'Noida'),
        (5, 'Zoya', CAST(NULL AS STRING))
      ]);
      
      CREATE OR REPLACE TABLE sales.orders AS
      SELECT * FROM UNNEST([
        STRUCT(101 AS order_id, 1 AS customer_id, 'Laptop' AS product,
               55000 AS amount, 'delivered' AS status, DATE '2026-01-05' AS order_date),
        (102, 2, 'Mouse', 700, 'delivered', DATE '2026-01-06'),
        (103, 1, 'Keyboard', 1500, 'delivered', DATE '2026-01-09'),
        (104, 3, 'Monitor', 12000, 'cancelled', DATE '2026-01-12'),
        (105, 2, 'Laptop', 52000, 'delivered', DATE '2026-01-15'),
        (106, 4, 'Mouse', 650, 'pending', DATE '2026-01-18')
      ]);

      How it fits together

      1. Project: shop-prod
      2. Dataset: sales
      3. Table: orders

      Read a table by its full name

      BigQuery walks down the three levels to find the table.

      SQL

      SELECT order_id, product, amountFROM `shop-prod.sales.orders`WHERE status = 'delivered';

      Rows at this step

      order_id | product | amount
      ---------+---------+-------
      101      | Laptop  | 55000
      102      | Mouse   | 700

      Try it yourself

      1. Search for BigQuery sandbox and open BigQuery in the Google Cloud console. The sandbox is free and asks for no credit card.
      2. Copy the Set up the practice tables script above into the editor and press Run.
      3. Run the walkthrough query, but use your own table name sales.orders.

      Question 1 Β· Easy

      Which order goes from biggest to smallest?

      Question 2 Β· Medium

      BigQuery is serverless. What does that mean for you?

      Question 3 Β· Hard

      A table has 100 columns and your query names only 2. Why is that quick in BigQuery?

      Key takeaways

      BigQuery is Google Cloud's serverless data warehouse. Data sits in project β†’ dataset β†’ table. You ask in SQL and BigQuery reads only the columns you name.

      Lesson 1 of 90

      Save your progress

      Start free and your progress, code and notes stay saved. Free for 1 month, no card needed.

      Start free Log in
      What is BigQuery?
      Save your progress free for 1 month. Start free Β· Log in