Introduction Keyboard shortcuts for SQL Editor

6. Keyboard shortcuts for SQL Editor

After you finish the course and Practice exercises, you’ll know everything to apply SQL at work and answer any question with data.

Imagine that you’ll be typing 20-30 queries every day, which is 100-150 queries a week or 5000-7000 queries a year. 🙀

If we can save a minute on each query by learning keyboard shortcuts we can roughly save 10 days a year on typing SQL. 2-week vacation from typing SQL effectively – not bad, huh? 🌴

Form submit

The most frequent thing you’ll be doing in the course and later at work is clicking on a “Run query”. Hundreds and hundreds of times. 💯

To submit a query (or any form on SQL Habit ⚠) press:

CMD + Enter on Mac
CTRL + Enter on Windows

Autocomplete in SQL editor

Rarely you’ll need to type the whole keyword in the SQL Editor – all thanks to autocomplete. It’ll suggest you SQL keywords, table and column names.

Just press the Tab key to complete the suggested word.

Move selected lines left or right

This is the shortcut I can’t live without. I use it all the time when moving a query to a subquery. I mean from this:

FROM users
  status = 'customer'

into this by moving this query ☝ one tab to the right and a couple of lines up inside the WITH ... AS statement:

WITH customers AS (
  FROM users
    status = 'customer'

FROM customers

Sql shortcuts

You’ll find all the details about it in the course later. For now just remember that:

CTRL + [ will move selection one tab to the left
CTRL + ] will move selection one tab to the right

💡 You can also move selected lines one tab to the right by pressing Tab.

Move selected lines up or down

To move a number of selected lines up or down press:

ALT + ⬆
ALT + ⬇

Move to the beginning/end of a keyword

To move between words in a line you can use left/right keys – they’ll move the cursor one character at a time.

A more efficient way is to jump between words. All you need to do is to press:

ALT + ◀
ALT + ▶

Move to the beginning/end of line

Of course, if you need to move to the beginning or end of the line jumping between words could also become inefficient.

We can jump straight to the beginning or end of the line by pressing:

CMD + ◀ or ▶ on Mac
CTRL + ◀ or ▶ on Windows


If you want to roll back the recent changes you made just press:

CMD + z on Mac CTRL + z on Windows

Good news: these shortcuts ☝ work in the vast majority of code editors. You can use them to edit SQL queries, code in any other programming language or even plain text for your notes or a blog post.

Try to master these shortcuts as you go through the SQL Habit course and remember – it’s all about a 2-week vacation 😆 🌴 🚀

Anatoli Makarevich, author of SQL Habit About SQL Habit

Hi, it’s Anatoli, the author of SQL Habit. 👋

SQL Habit is a course (or, as some of the students say, “business simulator”). It’s based on a story of a fictional startup called Bindle. You’ll play a role of their Data Analyst 📊 and solve real-life challenges from Business, Marketing, and Product Management.

SQL Habit course is made of bite-sized lessons (you’re looking at one atm) and exercises. They always have a real-life setting and detailed explanations. You can immediately apply everything you’ve learned at work. 🚀

“well worth the money”

Fluent in SQL in a month

Master Data Analysis with SQL with real life examples from Product Management, Marketing, Finance and more.
-- Type your query here, for example this one -- lists all records from users table: SELECT * FROM users
Loading chart... ⏳