Quickstart Using the Web UI

You can use the BigQuery web UI as a visual interface to complete tasks like running queries, loading data, and exporting data. This quickstart shows you how to query public tables and load sample data into BigQuery.

Before you begin

  1. Sign in to your Google account.

    If you don't already have one, sign up for a new account.

  2. Select or create a Cloud Platform Console project.

    Go to the Projects page

  3. Enable billing for your project.

    Enable billing

  4. BigQuery is automatically enabled in new projects. To activate BigQuery in a pre-existing project, go to Enable the BigQuery API.

    Enable the API

Query a public dataset

The BigQuery web UI provides an interface to query tables, including public tables offered by BigQuery.

  1. Go to the BigQuery web UI.

    Go to the BigQuery web UI

  2. Click the COMPOSE QUERY button.

  3. Copy and paste the following query into the New Query text area:

    SELECT
     weight_pounds, state, year, gestation_weeks
    FROM
     publicdata:samples.natality
    ORDER BY weight_pounds DESC LIMIT 10;
    
  4. Click the circular icon to activate the query validator.

    BigQuery web UI query validator

    A green or red section displays above the buttons depending on whether the query is valid or invalid. If valid, the validator also describes the amount of data that will be processed once you run the query. This is helpful for determining how much a query will cost to run.

  5. Click the RUN QUERY button. The query results display below the buttons.

    BigQuery web UI query results

The above query accesses a table from a public dataset that BigQuery provides.

You can browse the schema of other public tables by clicking publicdata:samples in the left-hand navigation. The expanded list of titles are all of the public tables you can query against.

Load data into a table

Next, we'll load custom data into a table and run a query against it.

As a reminder, billing must be enabled to run this part of the quickstart. For more information, see Before you begin.

Download custom data

The custom data contains approximately 7 MB of data about popular baby names, and is provided by the US Social Security Administration.

  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 see what it looks like. The file is a comma-separated value (CSV) file with the following three columns: name, sex (M or F), and number of children with that name. The file has no header row.

  4. Note the location of the yob2014.txt file so that you can find it later.

Create a dataset

Next, create a dataset in the web UI to hold the data.

  1. Go to the BigQuery web UI.

    Go to the BigQuery web UI

  2. Click the down arrow icon down arrow icon next to your project name in the navigation, then click Create new dataset.

  3. Input the following name for the dataset ID.

    babynames
    

    Dataset IDs are unique on a per-project basis, so if babynames is already listed under your project name in the navigation, append a number to the name to make it unique. Click the question mark icon to see ID limitations.

  4. Leave all of the other default settings in place and click OK.

Load the data into a new table

Next, load the data into a new table.

  1. In the navigation, hover on the babynames dataset ID that you just created.

  2. Click the down arrow icon down arrow icon image next to the ID and click Create new table.

    babynames down arrow icon image

    Use the default values for all settings unless otherwise indicated.

  3. Under Source Data, click the Choose file button. Navigate to the data you unzipped in the step above, and select the yob2014.txt file.

  4. Under Destination Table, enter the following value for the destination table name.

    names_2014
    
  5. In the Schema section, click the Edit as text link.

    edit as text link

    Then replace the contents of the Schema input area with the following schema:

    name:string,gender:string,count:integer
    
  6. Click the Create Table button.

  7. Wait for BigQuery to create the table and load the data. While BigQuery loads the data, a (loading) string displays after your table name in the navigation. The string disappears after the data has been fully loaded.

Preview the table

After the (loading) string disappears, you can access the table. To preview the first few rows of the data:

  1. Select names_2014 in the navigation.

  2. Click Preview in the Table Details: names_2014 section.

    BigQuery web UI table preview

Query the table

Now that you've loaded custom data into a table, you can run queries against it. The process is identical to the query a public dataset example above, except that this time, you're querying your custom table instead of a public table.

  1. Click the COMPOSE QUERY button.

  2. Copy and paste the following query into the New Query text area.

    SELECT
      name, count
    FROM
      babynames.names_2014
    WHERE
      gender = 'M'
    ORDER BY count DESC LIMIT 5;
    

    The above query displays the top 5 men's names for the year of data you loaded into the table.

Clean up

To avoid incurring charges to your Google Cloud Platform account for the resources used in this quickstart:

  1. Go to the BigQuery web UI.

    Go to the BigQuery web UI

  2. In the navigation, hover on the babynames dataset you created.

  3. Click the down arrow icon down arrow image next to your dataset name in the navigation, then click Delete dataset.

  4. In the Delete dataset dialog box, confirm the delete command by typing the name of your dataset (babynames) and clicking OK.

What's next

Send feedback about...

BigQuery Documentation