Building, fitting, and scoring a model with SQL alone
BigQuery ML lets you create, train, and evaluate machine learning models directly in BigQuery using standard SQL, eliminating the need to export data to a separate ML platform. Models are created with CREATE MODEL statements, trained on data via SELECT queries, and evaluated using built-in functions like ML.EVALUATE. This keeps data, training, and prediction all within BigQuery's serverless environment.
1 · Learn the must-know
- The CREATE MODEL statement defines the model type via OPTIONS (e.g.,
model_type='linear_reg', 'logistic_reg', 'kmeans', 'boosted_tree_classifier') and specifies the label column for supervised models. - Training data is supplied via the AS SELECT clause of CREATE MODEL, so any query result (joins, filters, transformations) can become training input.
- ML.EVALUATE returns model-specific metrics (e.g., precision, recall, ROC AUC for classification; RMSE, R² for regression) and can be run against a held-out evaluation set or the training data if none is specified.
- ML.PREDICT is used to generate predictions on new data using a trained model, returning predicted labels/values alongside input features.
- BigQuery ML automatically splits data into training and evaluation sets when no explicit split is provided, but you can control this via options like
DATA_SPLIT_METHOD. - Model training and prediction incur BigQuery processing costs based on bytes processed (or flat-rate slots), and some model types (e.g., DNN, boosted trees, AutoML-backed models) may have different pricing or resource behavior than simple linear/logistic models.
2 · Check your understanding
A data analyst at a retail company wants to use BigQuery ML to predict whether a customer will cancel their subscription (a binary outcome: yes or no) based on historical account activity stored in a BigQuery table. Which model_type should the analyst specify in the CREATE MODEL statement?
What you have tried across GCP ADP's objectives, not a readiness score.
Data Preparation and Ingestion~30% of the exam0 of 8 tried
Data Analysis and Presentation~27% of the exam0 of 12 tried
Data Pipeline Orchestration~18% of the exam0 of 9 tried
Data Management~25% of the exam0 of 12 tried
3 · Keep going
Ready for more? Take a weighted mock or try free practice questions.