Learn how to make SQL easier by using an Elgato Streamdeck to automatically type your commands (macros).

First of all, SQL stands for Structured Query Language. Essentially, its some basic code you write to retrieve information from tables in a database. As the name suggests, the queries have a structure to them, which allows you to retrieve data in a more organised way.

After some training sessions at the Data School, and looking around through List of SQL Commands | Codecademy, I have come to the conclusion that the most basic SQL queries could realistically be made easier if I could just press a button that spits out various commands.

The basic syntax of SQL goes:

SELECT [Column]
FROM [Table]
WHERE [Column] = [Value]
ORDER BY [Value] desc

Over time, if you SQL alot, youll probably get to a point where you are typing variations of these out constantly. But why end up with RSI when you can press less buttons to pump out some SQL commands. Which is where the Elgato Streamdeck comes in. A Streamdeck is essentially a macropad, capable of performing macros and other actions, but with LCD screens behind each button for aesthetic purposes. I actually purchased it years ago, back when I dreamed of being a moderately popular twitch streamer (just kidding). In the end I mostly used it for typing up formulas, performing shortcuts, opening programs. But really, I mostly used it for controlling my Spotify.

When the Data School first introduced me to SQL, I thought maybe I could use it for this too.

SQL with Streamdeck

Configuring the Streamdeck to type SQL isnt even that difficult. All it takes is to drag a ‘text’ button from the list of possible actions onto the profile, type in what you want it to write for you, and then slap on a label.

In the text field above I can get the Streamdeck to type ‘SELECT DISTINCT’ whenever I press that button. For now I have it configured to just type the most basic commands, but if I wanted to, I could get it to write more complicated code. Realistically, its only a fraction faster than typing it out yourself (depending on your wpm), but at least its easier on your fingers.

SELECT 

SELECT DISTINCT 

BETWEEN 

FROM 

WHERE 

ORDER BY 

GROUP BY 

All of this in 7 button presses. That’s like an 88.4% reduction in characters typed.

Did I just solve SQL? No. But now I dont have to worry about accidentally misspelling basic SQL commands. I’ll give it a try and see if this makes my SQL life any harder/easier. Im also going to try and integrate this with Alteryx/Tableau in some way. But thats for another blog.

 

The Data School
Author: The Data School