SQL Isn't That Hard (When You Learn by Exploration)

Miranda Auhl, Developer Advocate at Timescale

Is SQL hard to learn? And what do you use it for in your daily dev duties? A developer advocate at Timescale, Miranda Auhl mainly uses SQL for troubleshooting, creating new content for developers, or learning something new. The programming language only became a tool in her work kit after university, where she nearly embarked on a Ph.D. in Pure Mathematics, later building data warehouses and becoming a quality engineer.

Miranda is driven by her love for analyzing and finding new ways to visualize data to create value in her current role—something she also does in her spare time. A self-proclaimed creator, you will likely find her fixing hardwood floors, making baby blankets for friends and family, gardening, or doing ceramics. In this interview series on how tech professionals learned SQL, her tips are especially useful for those who, just like her, love to learn by exploration.

At Timescale, we love SQL. We built TimescaleDB, our relational database for time series, on a foundation of PostgreSQL. We think a database should be boring, meaning it’s easy to use, scales without much effort, and you never have to think about its reliability or performance. When it comes to databases, boring is awesome. By packaging TimescaleDB as an extension to PostgreSQL, we not only get rock-solid dependability but also enable developers to use SQL, one of the world’s most popular programming languages, to build great time-series applications. To celebrate our love for SQL, we interviewed several of our employees and favorite PostgreSQL community members for this series on how they learned and came to love SQL.

Today, we’re speaking with Miranda Auhl. We hope this series helps you learn about new tools, training, and applications for PostgreSQL. Be sure to check out our interview with David Kohn, and stay tuned for more throughout the month.

Can you give us a brief overview of your history with SQL? Is SQL hard to learn? When did you first start learning it, and when did you feel like you become more expert?

I first started learning it after university. I had some exposure to other languages before SQL so learning it came somewhat naturally. I really love SQL because it is at heart a more intuitive language to learn. Most of the keywords and functions have naming conventions that just make sense.

For me, it was so cool that I could SELECT specific columns FROM a specific table and either ORDER BY specify WHERE I wanted the filtering to be done. Personally, when I write queries, I can visualize how the columns and groups are being manipulated in my head. It may be strange, but I see data in my head as physical elements which I can manipulate.
It wasn’t really until this job that I felt I was beginning to really be less of a novice and more of an expert, though I believe I am still quite far off from being a SQL expert. I’m definitely still learning, but maybe now finally past a novice level.

Okay, visualizing columns must be a superpower linked to your academic background. Can you tell us a bit more about that?

My career path is a little all over the place and both a sad but happy journey. I was planning to go for a Ph.D. in Pure Mathematics with a focus in number and group theory. Unfortunately, the fall before I was planning to start my Ph.D., my mother suddenly passed away. I honestly didn’t know what to do with myself at that point. It was the lowest I had ever been in my life.

At that point, Ryan Booz [director of developer advocacy at Timescale] reached out to me with an internship as a possibility to consider now that I knew I wanted to stay in my town and around my community. In that first job, I learned a ton. I was helping Ryan to set up a data warehouse aggregating data from hundreds of databases. I taught myself SQL, R, and Python to explore data analytics techniques. I was interested in how we could use all this data to help inform decision-making for the company.

“There is something so satisfying about taking data, analyzing it, and generating value; whether that is in showing folks how to use tools, or creating value from the data itself”

After working for that first company as an intern and then full-time employee, I was given the opportunity to work for a statistical software company as a quality engineer. This role was a pretty big switch-up. While I generally focused on backend and data science type work at my first company, in this job I worked mostly with statistics and frontend development. I ended up helping to develop and build a new JavaScript testing framework for an online product we were creating. It was a super cool experience because I got to help work on developing some of these frontend tools, create a new automated testing system, and do quite a bit of project management. This second job really gave me awesome insight into the frontend development and project management worlds.

After being at this statistical company for a while, I knew that I needed more of a challenge. I had reached out to Ryan to ask about his developer relations experience to get his thoughts on the field. This was when he asked me to come to Timescale. I was pretty nervous about the move, to be honest, but I’m really glad that I did. Everyone here has been so kind and encouraging. I have really enjoyed doubling down on my database knowledge and working with data science techniques once again. There is something so satisfying about taking data, analyzing it, and generating value; whether that is in showing folks how to use tools, or creating value from the data itself.

What do you use SQL for in your current job?

Most often, I use SQL now when I am helping a user troubleshoot something, creating content, or learning something new. Honestly, I am most excited when I get a chance to use SQL and TimescaleDB functionality during work. It gives me a lot of energy when I get to explore data or troubleshoot problems.

Going back to your learning journey, did you teach yourself or take a course?

I learn best through exploration. I like listening to videos or reading about concepts, but by far, I learn best when I can sit down and just play around with something. The way I generally learn is by starting with a base prompt, for example, maybe working with window functions. I will then ask myself what I could do with my data using the concept, such as applying an aggregation function to a window. Here is usually where I start to run into things that go against what I originally thought about the concept. It’s really in the moments of misconceptions and surprises that I learn the most.

“I love talking to folks and listening to learn about things conceptually, but to understand what I could do with SQL, I had to explore it myself”

For example, I remember thinking that window functions were going to let me take chunks of time or subgroups from my data and then apply aggregation on those subgroups, with one output per subgroup or chunk. So it surprised me when I got a single output for each subgroup but showing for every row in the subgroup. It worked kind of like I expected, but also had an output that was totally unexpected. After playing around with things more, I realized it could be powerful in ways I didn’t expect and maybe also couldn't quite be used in the ways I initially thought.

All this to say, I love talking to folks and listening to learn about things conceptually, but to understand what I could do with SQL, I had to explore it myself.

What were you doing at the time you first started learning SQL? What problems were you solving?

When I first started with SQL, I worked with IoT usage data. My job was to aggregate and analyze usage data for energy, water, sewage, solar, etc. The company I worked for focused on helping folks become more sustainable, monitoring everything during the process to show how much they could save in all these areas before and after their sustainability initiatives.
Since each customer had their own database, it was really fun getting to learn SQL in the environment. I feel I was exposed to many different situations due to the massive amount of data and databases. Now, I honestly think I learn the most when I need to investigate a problem from developers that use TimescaleDB. Often when they come to our Slack or Forum, I don’t initially know how to solve their problem. But with some time, research, and investigation, I can almost always figure out what is going on, and either help nudge them in the right direction or answer their question outright.

What were some of your favorite things getting into it? What did you find hard?

My favorite part about learning SQL is really not unique to just it. I get a lot of joy out of learning something new. It gives me a lot of joy to learn something new and be able to do something useful with that knowledge. On the flip side, when I am learning something new, it is really hard and kind of scary for me. When I am faced with a concept I don’t know, I get scared and feel really intimidated. I get imposter syndrome almost every day, haha. Once I push through that and start learning about it and understanding it, that is one of the best feelings. To take something that scares you and turn it into a strength, that is power, my friend.

What tools do you use to work with SQL/ Postgres in particular? Do you have a favorite that you evangelize for?

The tools I use most often are Visual Studio Code and DBeaver. I love that DBeaver is free and allows me to have more visibility into my databases. I am a super visual person, so I love bouncing from table to query to table to another query, which is just tough to do in the terminal. I mean, that may just be me, but it’s how I think and work. And for context, DBeaver is an integrated development environment that folks can use to interact with their databases. It is free and open source.

The other tool I really enjoy is Visual Studio Code. This tool is one I began using in my previous job. It is super powerful for frontend development but also just super useful when developing projects that use multiple types of coding files (like Python, Markdown, SQL, JavaScript, you name it). Visual Studio Code is awesome when I need to pull my data into a Python script, say for machine learning or visualization.

🚀
Miranda’s Most Valuable Resources for Learning SQL:

https://www.kaggle.com/: This site is an amazing resource for getting started with Python, R, and data science in general. There are a lot of free datasets and courses you can go through.
https://www.codecademy.com/learn/learn-sql: Another good free learning resource. You can learn quite a bit about various languages through their website.
https://www.khanacademy.org/computing/computer-programming: Khan Academy has a bunch of really cool resources too that can be helpful when first starting off.
https://www.postgresqltutorial.com/: Great site for getting quick examples and help understanding SQL and PostgreSQL keywords and functions.
https://stackoverflow.com/: A learner and developer's best friend. StackOverflow is an awesome place to find answers to questions. I often come here for answers on how to do something.
https://www.youtube.com/: I also highly recommend looking up videos on YouTube for SQL and programming topics. There are tons of great folks out there making videos. We each learn differently so I guarantee there will be someone that can help you in your own journey!


What do you find frustrating about SQL or Postgres in particular? What tools do you wish there were but can’t seem to find?

I think the most frustrating part for me is the documentation for PostgreSQL. There is so much awesome content in there, but it is extremely difficult to parse, especially for beginners to PostgreSQL. I also think it would be amazing if there were more examples and projects folks could learn from. There have been quite a few times that I have needed insight on a particular use of a PostgreSQL function and could not find anything referring to it for the life of me. I had to scour Stack Overflow, where I finally found a use case. This was my main motivation for working on the Getting Started With Timescale series we recently released on YouTube.

Who inspires you most in the PostgreSQL community?

I really respect and look up to Lætitia Avrot. Seeing a powerful and intelligent woman be so integral in a tech space is just awesome. Not only does she command space in the PostgreSQL community, but she also works to empower other women in tech and particularly in the database space. In my experience, the database community has been some of the hardest to find footing in, especially as a woman in her early career. Of course, no tech community is perfect, but I feel it’s been far more difficult to break into the PostgreSQL community when compared to the JavaScript and frontend tech communities. Because of this, I respect the women working in PostgreSQL even more, and Lætitia in particular.

🚀
We just launched the third annual State of PostgreSQL survey to collect and share how PostgreSQL is used across the globe—and we'd love to hear about YOUR experiences.

Take the State of PostgreSQL 2022 survey! It is open until June 30 at 11:59 p.m. PT.