Getting started with BigQuery Web UI
Update your billing information
Activate your project API
- For active projects, go to Enable the BigQuery API.
- Your new BigQuery projects will automatically be enabled.
Create your first query
1. You will query tables and public data sets using the BigQuery web UI.
2. The first time you visit your BigQuery web UI a window will appear like this:
3. Choose Create a Project or work on an existing project.
4. On the upper left-hand corner, click .
5. Copy and paste the following code into the New Query text area:
#standardSQL
SELECT
weight_pounds, state, year, gestation_weeks
FROM
`bigquery-public-data.samples.natality`
ORDER BY weight_pounds DESC LIMIT 10;
6. Click the circular icon to activate the query validator.
A green check mark icon will display if your query is valid. The validator will describe the size of your data being processed and the cost of your query.
7. Click the button. Your results display below. The following query example accesses a table from a public BigQuery dataset.
Browse and query other public BigQuery data samples in the sidebar navigation of the web UI.
Download custom data into a table
You can use the sample popular baby names dataset to test BigQuery.
1. Download the baby names zip file.
2. Unzip the file onto your hard drive. The zip file contains a read me file that describes the dataset schema. Learn more about the dataset.
3. Open the file named yob2014.txt to review its comma-separated value (CSV) structure.
4. The three columns: name, sex (M or F), and number of children with that name.
5. Remember the location where you saved the yob2014.txt file so that you can find it later.
Create a dataset
1. Go to the BigQuery web UI.
2. On the sidebar click the down arrow icon next to your project name.
3. Click Create new dataset.
4. Input the following name for the dataset ID.
babynames
Dataset IDs are unique. if babynames
is already listed under your project name in the navigation, make it unique. For example, change the name to babynames1
. Click the question mark icon to see dataset ID limitations.
5. Leave the other default settings as is and click OK.
Load the data into a new table
1. In the sidebar navigation, hover on the babynames dataset ID you just created.
2. Click the down arrow icon and click Create new table.
3. Use the default values for all settings unless indicated.
4. Under Source Data, click the Choose file button. Navigate to the yob2014.txt
file you saved on your computer in the previous section titled Download custom data into a table.
5. Under Destination Table, enter the following value for the destination table name:
names_2014
6. In the Schema section, click the Edit as Text link.
7. Replace the contents of the Schema input area with the following schema:
name:string,gender:string,count:integer
8. Click the Create Table button. Then wait for BigQuery to create the table and load the data.
As your data loads, a (loading) string displays next to your table name in the navigation. Once complete, the string disappears after your data has been fully loaded.
9. Preview the first few rows of the data by selecting names_2014 in the navigation.
10. Click Preview in the Table Details: names_2014 section.
Query the table
1. Click the Compose query button.
2. Copy and paste the following query into the New Query text area.
#standardSQL
SELECT
name, count
FROM
`babynames.names_2014`
WHERE
gender = 'M'
ORDER BY count DESC LIMIT 5;
Clean up your Google Cloud Platform account to avoid billing charges
1. Go to the BigQuery web UI.
2. In the sidebar navigation, hover on the babynames
dataset you created.
3. Click the down arrow icon next to your dataset name.
4. Click Delete dataset.
5. In the Delete dataset dialog box, confirm you want to delete by typing the name of your dataset (babynames
).
6. Click OK.