Running SQL queries
Execute single or multiple SQL queries with keyboard shortcuts or the run button
To run your first query, there are two methods: Either select the first line of SQL, either with your keyboard or with your mouse, and press
the key combination
CMD + Enter if you're on a Mac, or Ctrl + Enter if you're on a
Windows or Linux machine, or place your cursor on a query and press the same key combination. On mobile devices, you can tap the "Run query" button on the upper right corner.
To run multiple queries, select the queries and press the same key combination.
The result of the query that was executed can then be found in the lower main area as a table:
SELECT 1 as nr, 'test' as text;
You can also run multiple queries sequentially, e.g. to create a table, insert some records,
and display the results:
CREATE TABLE first_names (name VARCHAR, birth_cnt integer);
INSERT INTO first_names (name, birth_cnt) VALUES ('Liam', 20456);
INSERT INTO first_names (name, birth_cnt) VALUES ('Noah', 18621);
INSERT INTO first_names (name, birth_cnt) VALUES ('Oliver', 15076);
INSERT INTO first_names (name, birth_cnt) VALUES ('James', 12028);
INSERT INTO first_names (name, birth_cnt) VALUES ('Elijah', 11979);
INSERT INTO first_names (name, birth_cnt) VALUES ('William', 11282);
INSERT INTO first_names (name, birth_cnt) VALUES ('Henry', 11221);
INSERT INTO first_names (name, birth_cnt) VALUES ('Lucas', 10909);
INSERT INTO first_names (name, birth_cnt) VALUES ('Benjamin', 10842);
INSERT INTO first_names (name, birth_cnt) VALUES ('Theodore', 10754);
SELECT * FROM first_names;
When you copy & paste the above SQLs, select them and run them, the result looks like this:
You can see on the left-hand side the newly created table
first_names, that can be reused for
other queries without having to reload the data again. Please keep in mind though that only the result of the
last-run query will be displayed in the lower main result area. The data is persisted until you reload the
overall SQL Workbench page.