Arcade Base Camp October 2026 | GSP281
Solution for Arcade Base Camp October 2026 | GSP281. 1 lab: GSP281. Fast copy-paste commands for Google Cloud.
GSP281 — Introduction to SQL for BigQuery and Cloud SQL
Estimated time: 35 minutes
# 🚀 Introduction to SQL for BigQuery and Cloud SQL | GSP281 > ⚠️ **Disclaimer:** This is an independent, community-made walkthrough created for educational purposes, hands-on practice, and Google Cloud certification preparation. This guide is designed to help learners understand SQL querying with BigQuery and data movement between BigQuery, Cloud Storage, and Cloud SQL through practical exercises. Always attempt the lab yourself first and follow Google Cloud Skills Boost / Qwiklabs Terms of Se
clear
# Professional ANSI Color Variables
CYAN='\033[1;36m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
RESET='\033[0m'
BOLD='\033[1m'
echo -e "${CYAN}${BOLD}"
echo " ____ _ _ _ __ ___ "
echo " / __ \ | | (_) | / _| / _ \ "
echo " | | | |_ __| |__ _| |_ ___ | |_ | | | |_ __ ___ "
echo " | | | | '__| '_ \| | __| / _ \ | _|| | | | '_ \ / __| "
echo " | |__| | | | |_) | | |_ | (_) || | | |_| | |_) \__ \ "
echo " \____/|_| |_.__/|_|\__| \___/ |_| \___/| .__/|___/ "
echo " | | "
echo " |_| "
echo -e "${RESET}"
echo -e "${YELLOW}▶ Detecting project environment variables...${RESET}"
export PROJECT_ID=$(gcloud config get-value project)
export REGION=$(gcloud compute project-info describe \
--format="value(commonInstanceMetadata.items[google-compute-default-region])")
echo -e "${BLUE}▶ Creating Cloud Storage bucket (gs://${PROJECT_ID})...${RESET}"
gcloud storage buckets create gs://$PROJECT_ID --location=$REGION
echo -e "${YELLOW}▶ Querying BigQuery to generate 'start_station_name.csv' natively...${RESET}"
bq query --use_legacy_sql=false --max_rows=10000 --format=csv \
'SELECT start_station_name, COUNT(*) AS num FROM `bigquery-public-data.london_bicycles.cycle_hire` GROUP BY start_station_name ORDER BY num DESC' \
> start_station_name.csv
echo -e "${YELLOW}▶ Querying BigQuery to generate 'end_station_name.csv' natively...${RESET}"
bq query --use_legacy_sql=false --max_rows=10000 --format=csv \
'SELECT end_station_name, COUNT(*) AS num FROM `bigquery-public-data.london_bicycles.cycle_hire` GROUP BY end_station_name ORDER BY num DESC' \
> end_station_name.csv
echo -e "${BLUE}▶ Uploading CSV files to Cloud Storage...${RESET}"
gcloud storage cp start_station_name.csv gs://$PROJECT_ID/
gcloud storage cp end_station_name.csv gs://$PROJECT_ID/
echo -e "${CYAN}▶ Provisioning Cloud SQL Instance 'my-demo' (This will take 3-5 minutes)...${RESET}"
# Using db-f1-micro to significantly speed up deployment while bypassing the larger, slower presets[cite: 12]
gcloud sql instances create my-demo \
--database-version=MYSQL_8_0 \
--region=$REGION \
--tier=db-f1-micro \
--root-password='ChangeMe1!'
echo -e "${CYAN}▶ Creating database 'bike' in 'my-demo'...${RESET}"
gcloud sql databases create bike --instance=my-demo
echo -e "${GREEN}✓ All tasks completed! Bucket created, queries extracted natively, Cloud SQL instance spun up, and database configured. You may now verify your progress on the lab page.${RESET}"