3 of 11Image
BigQuery offers a simple, easy to master browser console, providing for dataset browsing on the left and SQL querying on the right. When queries are returned, options appear to let you save the results in alocal CSV file or create a new table containing the result set’s content.
A simple query against the sample github_timeline table is shown here. The first few rows from the results of the query appear on the bottom-right of the screen, along with navigation controls that allow you to page through the data. Note the “Save as Table” and “Download as CSV” options, which work nicely in Chrome and FireFox. Unfortunately, the "Save as Table" option is not available in Internet Explorer (nor is a file upload option we'll look at shortly). Everything in BigQuery also works nicely in Safari on the iPad, though you can’t save or upload local files there either.
BigQuery data is stored in tables, much as in a relational database. Tables, in turn, are stored within datasets. Datasets serve as a unit of security, allowing for sharing with specific users or the overall public. Google supplies the publicdata:samples dataset which is added to every BigQuery project. This allows you to examine and query tables right away.
At the left side of the screen, you can drill down on a dataset to see the tables it contains. Select one of those tables and its schema will appear on the right-hand side of the console. The github_timeline table’s schema is displayed in this figure. Notice that its label on the left side of the screen appears in bold text with a red bar beside it. The “Click to preview table data” link does what it says, but you can also write your own SQL queries.
To run a Query, type it in, then click the “RUN QUERY” button or just tap Ctrl-Enter on your keyboard. While the query is running, the query text area is disabled and the elapsed query time clock runs up, right next to the “Query running” label.
BigQuery does not permit “SELECT *”-style queries; instead, you must specify all column names. And although you’ll be querying large datasets, you will want to keep your result sets small. To do that, make use of aggregating queries (using aggregate functions and GROUP BY) and/or the LIMIT n clause at the end of your query as was done here (i.e. “LIMIT 200” appears at the end of the query).
Tables are identified using a syntax of datasetname.tablename. If you reference any table from the samples dataset, you’ll need to use the “publicdata:” prefix before the “samples” dataset name.