Welcome to the Commonwealth SQL Console! Input SQL queries on your own tables or on public tables and get back results! Here's an example to try:
select * from example.foo
The console uses Commonwealth SQL dialect, which is mostly the same as Cloud Spanner SQL. Commonwealth supports select, insert, update, delete, and create table queries, among others.
When you execute a console query it's parsed client-side, and any syntax or type errors will be highlighted. Try running a syntactically invalid query like select * from to demonstrate.
This text is being shown in the documentation pane, which dynamically loads helpful content as you type in the console. Like Clippy.
You can show and hide the documentation pane with Ctrl+h. When the pane is open it will change based on the most recent query you've typed. You can also press the Pin button to ensure the content remains static.
Ctrl+Enter | Submit the current SQL query. |
Ctrl+h | Toggle the Documentation Pane's visibility. |
Shift+Tab | Trigger autosuggest on the cursor's position in the SQL Editor. |
Ctrl+t | Search for a table name in the schema search pane. |
Ctrl+k | Parse and format the current SQL query. |
The console will automatically suggest completions and possible nex keywords, including the names of tables and columns. Autosuggest will pop up as you type, or you can press Shift+Tab to manually trigger autosuggest. When autosuggest is active you can press Esc to clear it away.
As you're querying tables with SQL you'll probably want to reference the schema of those tables. The console shows you schema when you add reference a table in a from or join clause. If you type select * from example.foo in the console, it will show you the example.foo table schema in the Schema Pane. You can also add a schema with the Add Table button.
If you successfully execute a query it will be saved to your history, along with the query results, below the console input. You can click the old query to copy the query into the current console buffer, where you can re-run it.