BigQuery Basics
BigQuery is a serverless, AI-ready data platform that enables high-speed
analysis of large datasets using SQL and Python. Its disaggregated architecture
separates compute and storage, allowing them to scale independently while
providing built-in machine learning, geospatial analysis, and business
intelligence capabilities.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-basics)"
and append agent-skills/1.0 (skill:bigquery-basics) to User-Agent headers.
Setup and Basic Usage
Enable the BigQuery API:
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-basics)" \
gcloud services enable bigquery.googleapis.com --quiet
Create a Dataset:
bq mk --dataset --location=US my_dataset
Create a Table:
Create a file named schema.json with your table schema:
[
{
"name": "name",
"type": "STRING",
"mode": "REQUIRED"
},
{
"name": "post_abbr",
"type": "STRING",
"mode": "NULLABLE"
}
]
Then create the table with the bq tool:
bq mk --table my_dataset.mytable schema.json
Run a Query:
bq query --use_legacy_sql=false \
'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` \
WHERE state = "TX" LIMIT 10'
Reference Directory
Core Concepts: Storage types, analytics
workflows, and BigQuery Studio features.
Change History: Tracking and querying
incremental table changes using APPENDS and CHANGES.
Continuous Queries: Running continuous
SQL statements to analyze incoming data in real time.
CLI Usage: Essential bq command-line tool
operations for managing data and jobs.
Client Libraries: Using Google Cloud
client libraries for Python, Java, Node.js, and Go.
MCP Usage: Using the BigQuery remote MCP server and
Gemini CLI extension.
Infrastructure as Code: Terraform examples for
datasets, tables, and reservations.
IAM & Security: Roles, permissions, and data
governance best practices.
Usage Attribution: Standardized usage attribution
tags for gcloud CLI, REST API, and MCP requests.
If you need product information not found in these references, use the
Developer Knowledge MCP server search_documents tool.
Related Skills
- BigQuery AI & ML Skill:
SKILL.md file for BigQuery AI and ML capabilities (forecast, anomaly
detection, text generation).
1---2name: bigquery-basics-23metadata:4 source: https://skillmd.com/skills/google/bigquery-basics-25 version: "1.0.2"6 category: BigDataAndAnalytics7description: >-8 Manages datasets, tables, and jobs in BigQuery. Use when you need to interact9 with BigQuery, run SQL queries, manage BigQuery resources (datasets, tables,10 views), or perform basic data ingestion and analysis.11---1213# BigQuery Basics1415BigQuery is a serverless, AI-ready data platform that enables high-speed16analysis of large datasets using SQL and Python. Its disaggregated architecture17separates compute and storage, allowing them to scale independently while18providing built-in machine learning, geospatial analysis, and business19intelligence capabilities.2021## Attribution2223**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you24MUST read [Usage Attribution](references/attribution.md). For commands executed25directly in the terminal (never in generated scripts, Terraform, or user code),26prefix `gcloud` with27`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-basics)"`28and append `agent-skills/1.0 (skill:bigquery-basics)` to `User-Agent` headers.2930## Setup and Basic Usage31321. **Enable the BigQuery API:**3334 ```bash35 CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-basics)" \36 gcloud services enable bigquery.googleapis.com --quiet37 ```38392. **Create a Dataset:**4041 ```bash42 bq mk --dataset --location=US my_dataset43 ```44453. **Create a Table:**4647 Create a file named `schema.json` with your table schema:4849 ```json50 [51 {52 "name": "name",53 "type": "STRING",54 "mode": "REQUIRED"55 },56 {57 "name": "post_abbr",58 "type": "STRING",59 "mode": "NULLABLE"60 }61 ]62 ```6364 Then create the table with the `bq` tool:6566 ```bash67 bq mk --table my_dataset.mytable schema.json68 ```69704. **Run a Query:**7172 ```bash73 bq query --use_legacy_sql=false \74 'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` \75 WHERE state = "TX" LIMIT 10'76 ```7778## Reference Directory7980- [Core Concepts](references/core-concepts.md): Storage types, analytics81 workflows, and BigQuery Studio features.8283- [Change History](references/change-history.md): Tracking and querying84 incremental table changes using APPENDS and CHANGES.8586- [Continuous Queries](references/continuous-queries.md): Running continuous87 SQL statements to analyze incoming data in real time.8889- [CLI Usage](references/cli-usage.md): Essential `bq` command-line tool90 operations for managing data and jobs.9192- [Client Libraries](references/client-library-usage.md): Using Google Cloud93 client libraries for Python, Java, Node.js, and Go.9495- [MCP Usage](references/mcp-usage.md): Using the BigQuery remote MCP server and96 Gemini CLI extension.9798- [Infrastructure as Code](references/iac-usage.md): Terraform examples for99 datasets, tables, and reservations.100101- [IAM & Security](references/iam-security.md): Roles, permissions, and data102 governance best practices.103104- [Usage Attribution](references/attribution.md): Standardized usage attribution105 tags for `gcloud` CLI, REST API, and MCP requests.106107*If you need product information not found in these references, use the108Developer Knowledge MCP server `search_documents` tool.*109110## Related Skills111112- [BigQuery AI & ML Skill](../bigquery-ai-ml):113 SKILL.md file for BigQuery AI and ML capabilities (forecast, anomaly114 detection, text generation).