Ends in
00
hrs
00
mins
00
secs
SHOP NOW

⏲️ 48-Hour Bonus Sale - Get 25% OFF any product. Use Coupon code: TD-NY2026

Back to Course

GCP PlayCloud Labs

0% Complete
0/0 Steps
  1. GCP PlayCloud Labs
  2. Guided Lab: How to Launch a GCP Compute Engine Linux Instance
  3. Guided Lab: Creating a VM Using Instance Templates
  4. Guided Lab: Creating and Managing Instance Groups in Compute Engine
  5. Guided Lab: Creating a Spot VM Instance
  6. Guided Lab: Configuring Shielded VM Options
  7. Guided Lab: Exploring Instance Metadata in Google Cloud
  8. Guided Lab: Vertically Scaling a VM Instance
  9. Guided Lab: Setting up a Web Server on a VM Instance
  10. Guided Lab: Using Startup Scripts in GCP VM Instances
  11. Guided Lab: Creating a Custom Image from a VM Instance with Web Server in Google Cloud
  12. Guided Lab: Setting Up and Managing a Database on a VM Instance
  13. Guided Lab: Installing WordPress on an Ubuntu VM Instance with LEMP Stack
  14. Guided Lab: Reserving or Promoting a Static IP Address for a VM Instance
  15. Guided Lab: SSH Access to GCP VM Instance from Local Machine using SSH Key Pair
  16. Guided Lab: Guarding Your VM with Deletion Protection
  17. Guided Lab: Creating a Cloud Storage Bucket
  18. Guided Lab: Hosting a Static Website in Google Cloud Storage Bucket
  19. Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning
  20. Guided Lab: Using Cloud Storage Lifecycle Rules to Automate Object Management
  21. Guided Lab: Managing Cloud Storage Buckets via SSH Commands
  22. Guided Lab: Creating a Cloud SQL Instance
  23. Guided Lab: Running SQL Commands in Cloud SQL Studio
  24. Guided Lab: Creating and Restoring Cloud SQL Backups
  25. Guided Lab: Integrating Cloud SQL Database instance with a VM instance
  26. Guided Lab: Connecting Cloud SQL Database with MySQL Workbench (Local)
  27. Guided Lab: Guarding Your Cloud SQL Instances with Deletion Protection
  28. Guided Lab: Creating a Cloud NAT Gateway
  29. Guided Lab: Creating a Google Kubernetes Engine (GKE) Cluster
  30. Guided Lab: Connecting to a Kubernetes Engine Cluster
  31. Guided Lab: Deploying a Simple Web Application on GKE
  32. Guided Lab: Creating a Custom Virtual Private Cloud (VPC)
  33. Guided Lab: Establishing VPC Peering for Secure Cross‑Network Communication
  34. Guided Lab: Configuring Firewall Rules to Secure and Access a VM
  35. Guided Lab: Deploying a LAMP Stack on a Compute Engine VM
Lesson 23 of 35
In Progress

Guided Lab: Running SQL Commands in Cloud SQL Studio

Description

Cloud SQL Studio provides authorized users with a direct way to interact with SQL databases from the Google Cloud Console. It allows you to run SQL queries to access and manage data without needing external tools. The interface supports common operations you would normally perform in a SQL command‑line client, such as creating and modifying tables, building indexes, or defining views.

The Studio features an integrated Explorer pane, a query editor, and a results table, giving you a complete environment for database management. From this single interface, you can execute DDL, DML, and DQL statements. For instance, rather than setting up a third‑party query tool, you can simply use the built‑in editor to create tables and query your data directly within Cloud SQL Studio.

In this guided lab, you’ll learn how to create a MySQL instance, set up users and databases, and run SQL commands directly in Cloud SQL Studio.

Prerequisites

This lab assumes you have basic knowledge of creating a CloudSQL Instance.
If you find any gaps in your knowledge, consider taking this lab:

Objectives

In this lab, you will:

  • Create a MySQL instance in Cloud SQL.
  • Add a user account with custom credentials to access the Cloud SQL Studio.
  • Create a new database.
  • Run SQL commands in Cloud SQL Studio to create tables, insert data, and query results.

Lab Steps

Create a MySQL Instance

1. On the Create a MySQL instance page, set the Edition preset to Sandbox.

2. Enter your desired Instance ID.

3. Set a desired password for the root user.

4. Leave other configurations at their default values.

5. Click Create instance to start creating the instance.

Add a User Account

1. Once the instance is created, go to the Users tab.

2. Click Add user account.

3. Enter the desired User name and Password.

3. Click Add. A confirmation message will appear in the bottom‑left corner

Create a Database

1. Navigate to the Databases tab.

2. Click Create database.

3. Enter a Database name (e.g., EmployeesDB).

4. Once done, click Create Database.

Run SQL Commands in Cloud SQL Studio

1. Navigate to the Cloud SQL Studio tab.

2. Select the database you created (EmployeesDB).

3. Enter the credentials for the user account you added earlier.

4. Click Authenticate.

4. Once authenticated, open the Untitled query editor.

5. Once authenticated, you’ll be ready to run SQL commands in Cloud SQL Studio. Begin by creating a new table within the EmployeesDB database to store employee records.

Paste the following SQL command into the query editor:

CREATE TABLE Employees ( ID INT PRIMARY KEY, Name VARCHAR(50), Age INT, Salary DECIMAL(10, 2) );

Click the Run button to execute the SQL command.

This creates a table named Employees with four columns: ID, Name, Age, and Salary

6. Insert Data into the Table

INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (1, 'Jose Rizal', 25, 50000.00);

INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (2, 'Andres Bonifacio', 25, 50000.00);

INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (3, 'Emilio Aguinaldo', 25, 50000.00);

Click the Run button to execute the SQL commands.

These statements insert three employee records into the Employees table.

9. Query the Table

Run the following SQL command:

SELECT * FROM Employees;

Click the Run button to execute the SQL command.

This retrieves all rows and columns from the Employees table, displaying the data you inserted.

Congratulations! You have successfully created a MySQL instance, added a user account, built a database, and executed SQL commands in Cloud SQL Studio to create, populate, and query a table. You now have the foundational skills to manage Cloud SQL databases directly from the Google Cloud Console.

Skip to content