1
---
2
name: bigquery-basics
3
metadata:
4
version: "1.0.2"
5
category: BigDataAndAnalytics
6
description: >-
7
Manages datasets, tables, and jobs in BigQuery. Use when you need to interact
8
with BigQuery, run SQL queries, manage BigQuery resources (datasets, tables,
9
views), or perform basic data ingestion and analysis.
10
---
11
12
# BigQuery Basics
13
14
BigQuery is a serverless, AI-ready data platform that enables high-speed
15
analysis of large datasets using SQL and Python. Its disaggregated architecture
16
separates compute and storage, allowing them to scale independently while
17
providing built-in machine learning, geospatial analysis, and business
18
intelligence capabilities.
19
20
## Attribution
21
22
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
23
MUST read [Usage Attribution](references/attribution.md). For commands executed
24
directly in the terminal (never in generated scripts, Terraform, or user code),
25
prefix `gcloud` with
26
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-basics)"`
27
and append `agent-skills/1.0 (skill:bigquery-basics)` to `User-Agent` headers.
28
29
## Setup and Basic Usage
30
31
1. **Enable the BigQuery API:**
32
33
```bash
34
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-basics)" \
35
gcloud services enable bigquery.googleapis.com --quiet
36
```
37
38
2. **Create a Dataset:**
39
40
```bash
41
bq mk --dataset --location=US my_dataset
42
```
43
44
3. **Create a Table:**
45
46
Create a file named `schema.json` with your table schema:
47
48
```json
49
[
50
{
51
"name": "name",
52
"type": "STRING",
53
"mode": "REQUIRED"
54
},
55
{
56
"name": "post_abbr",
57
"type": "STRING",
58
"mode": "NULLABLE"
59
}
60
]
61
```
62
63
Then create the table with the `bq` tool:
64
65
```bash
66
bq mk --table my_dataset.mytable schema.json
67
```
68
69
4. **Run a Query:**
70
71
```bash
72
bq query --use_legacy_sql=false \
73
'SELECT name FROM `bigquery-public-data.usa_names.usa_1910_2013` \
74
WHERE state = "TX" LIMIT 10'
75
```
76
77
## Reference Directory
78
79
- [Core Concepts](references/core-concepts.md): Storage types, analytics
80
workflows, and BigQuery Studio features.
81
82
- [Change History](references/change-history.md): Tracking and querying
83
incremental table changes using APPENDS and CHANGES.
84
85
- [Continuous Queries](references/continuous-queries.md): Running continuous
86
SQL statements to analyze incoming data in real time.
87
88
- [CLI Usage](references/cli-usage.md): Essential `bq` command-line tool
89
operations for managing data and jobs.
90
91
- [Client Libraries](references/client-library-usage.md): Using Google Cloud
92
client libraries for Python, Java, Node.js, and Go.
93
94
- [MCP Usage](references/mcp-usage.md): Using the BigQuery remote MCP server and
95
Gemini CLI extension.
96
97
- [Infrastructure as Code](references/iac-usage.md): Terraform examples for
98
datasets, tables, and reservations.
99
100
- [IAM & Security](references/iam-security.md): Roles, permissions, and data
101
governance best practices.
102
103
- [Usage Attribution](references/attribution.md): Standardized usage attribution
104
tags for `gcloud` CLI, REST API, and MCP requests.
105
106
*If you need product information not found in these references, use the
107
Developer Knowledge MCP server `search_documents` tool.*
108
109
## Related Skills
110
111
- [BigQuery AI & ML Skill](../bigquery-ai-ml):
112
SKILL.md file for BigQuery AI and ML capabilities (forecast, anomaly
113
detection, text generation).
114