If you have ever read self-help books to optimize your life, you have probably encountered a prevailing message: shortcuts aren’t worth it. They might help you in the short term, but they will almost always hurt you in the long run.
Luckily, life and code are completely different. When it comes to coding, shortcuts are a must-learn, as they help you type faster in the long run — especially when you work with data.
If you have to constantly explore a data warehouse or build data models, speed is an invaluable skill to have. Being able to write SQL queries quickly will allow you to deliver analysis and business insights in a more efficient way. So you should start using shortcuts now.
How to optimize for shortcut learning
There’s one golden rule when learning shortcuts: try to learn the shortcuts that are used in many systems.
In this article, we’ll be showing you IDE shortcuts — shortcut keys that are being used by almost all code editors. Let’s start with the most common shortcuts that will already give your productivity a great boost.
9 basic SQL keyboard shortcuts you need to know
See all shortcuts
You need to find all possible commands in one place. For this, use the F1 key.
If you have a Mac with a touch bar (or the Windows equivalent), you need to press and hold the Fn
key before you’re able to see the F
keys.
Undo & redo
Unlike in real life, you can erase your mistakes (and make them again and again) in the digital world. Here’s how:
- CMD + Z to undo
- CMD + Y or Shift + CMD + Z to redo
Multi-line commenting
This command is an absolute must-know for any type of coder.
- For international keyboards, use CMD + /
- For other types of keyboards, here’s an alternative solution for you: Option + Shift + A
Search & replace
This is one that you probably already know.
- CMD + F
Run query
Instead of clicking the “Run query” button, just use:
- CMD + Enter
It’ll save you a lot more time.
Format query
Have you written a bunch of code and now you want to make it look nice?
Don’t do it by hand; just use:
- Shift + CMD + F
Multi-cursor
This one is a bit more advanced — but it will make you feel like an SQL master, so it’s definitely worth it.
When you need to change a lot of names (e.g., column names) or apply the same logic 1,000 times, this will come in very handy. Just hold Option + Shift and drag your cursor over all the lines you want to edit.
Basically, this is what superpowers look like.
List of must-know keyboard shortcuts
You can find all the above-mentioned shortcut keys neatly arranged in this list.
Time optimization is key
Coding can be a very time-consuming task, so learning how to accelerate the process will help you become more efficient and deliver better results in the long run. Therefore, implementing shortcuts into your daily practice is one of the main optimization techniques you can follow.
If you want to learn how to use these SQL keyboard shortcuts in a data analytics tool, then have a chat with our data experts at Y42. They can show you how quickly you can write data models using these shortcuts.
Category
In this article
Share this article