With so many things out there for an application developer to learn, we are often asked: why should I spend time learning SQL?
It’s a valid question! With ORMs available to translate most popular programming languages into SQL, it’s quite possible to develop an application that uses a SQL database without actually needing to know much SQL.
But there are lots of reasons why devs should still learn SQL. In fact, SQL is an important tool that can help with everything from performance optimization to debugging. Let’s take a look at just a few of the reasons why developers should learn SQL:
Application performance really comes down to three layers: the front-end, the application, and storage (i.e., the database).
Assuming you’ve written good code to begin with and your application was built using popular frameworks, squeaking performance gains out of those first two layers can be tricky. The storage layer is often the easiest place to find real performance improvements.
In a SQL database, something as simple as adding an index can lead to really impactful performance gains. But to identify that opportunity and make those improvements, you need to know SQL.
When you encounter a bug in your application, it’s not always easy to know which layer its coming from. Knowing SQL allows you to query the database directly, making it easier to diagnose problems there or simply to rule the database out as the source of the bug.
Similarly, you may sometimes get requests for data (from your boss, partners, customers, etc.) that the application isn’t built to provide. Being able to query the database manually with SQL will help you resolve these kinds of requests quickly when they arise.
ORMs are wonderful tools that make it much easier to connect your application to the database, and we always recommend using them. In practice, though, they’re not perfect, and you may occasionally encounter edge cases that the ORM wasn’t designed to handle.
That isn’t likely to happen often, but when it does, it’s very helpful to know how to handle it yourself using SQL.
Learning SQL and working with it regularly will give you a better understanding of how SQL databases function, and what should and shouldn’t be handled there.
For example, is a particular type of data validation going to be more performant if it happens in your application layer or if it’s enforced by the database? The answer to that question will vary based on the specifics, but it’s a question you’ll be much better equipped to answer if you know SQL and have a good grasp of how relational databases work.
Developers aren’t the only people who work with the database. And while DBAs, analysts, data scientists, etc. may not be familiar with the languages your application is written in, they are going to be familiar with SQL. This can make it easier for you to communicate clear requests, and respond to their database-related requests with queries that they can understand and use.
Even setting aside the benefits to your application and your company, learning SQL benefits you personally, too. SQL may be half a century old, but SQL databases are in use at just about every company on the planet, and modern distributed SQL databases can now offer unmatched performance, scalability, and consistency.
Top tech companies are looking for developers with SQL, particularly distributed SQL skills. Look up “CockroachDB” on a job board and scroll through the kinds of companies looking for those skills if you doubt us! SQL is always a good bullet point to have on your resume.
While “easy” is a very relative term, there’s no denying that SQL is one of the easier and faster languages to learn. The average application developer could learn pretty much all of the SQL they need over the course of a single weekend.
The biggest challenge to learning SQL is generally not SQL itself, but rather figuring out which parts of SQL are actually relevant enough to developers to warrant spending time on. That can be challenging, as most SQL courses out there are aimed at DBAs or data analysts.
That’s why we built our own SQL skills path: SQL for Application Developers. It’s completely free, and it covers pretty much everything a developer needs to know about SQL. Start learning now, and in roughly ten hours you could have valuable new SQL and distributed database skills to add to your resume!
This SQL cheat sheet is designed to make it quick and easy to find that SQL command that’s right on the tip of …Read more
Exporting data is a crucial tool in any database user’s toolkit. In CockroachDB, the EXPORT command has long …Read more
ADD CONSTRAINT is a SQL command that is used together with
ALTER TABLE to add constraints (such …