Learn SQL the Jedi way

Last edited on July 22, 2022

0 minute read

    Star Wars and SQL began together.

    In 1977, the first (eventually fourth) Star Wars film debuted in theaters. In that same year an emerging English language-based structured query language for data, originally called SEQUEL, was renamed to SQL*. For the Rebellion, it was A New Hope to fight the Empire. For the rest of us, it was the birth of a nifty little world-changing technology known as the relational database.

    *SEQUEL was created in 1974 to render Edgar F. Codd’s Relational Model of Data for Large Shared Data Banks into a more accessible form. Codd’s model was based on mathematical predicate calculus, which SEQUEL translated into an English-based programming language. Unfortunately, the acronym SEQUEL was already trademarked by the Hawker Siddeley aircraft company** so the name was changed to Structured Query Language and abbreviated as SQL.

    ** Yeah we never heard of them before either.

    Both the Skywalker Saga and databases have evolved a great deal over the decades hence. The original Star Wars films expanded into a media galaxy — a trilogy of trilogies, along with countless related content like comics, animated series, and novels, to name but a few. Similarly, SQL became the de facto language of working with data and inspired a galactic empire of new technologies: the RDBMS. OLAP. ORMs.

    For a while the Empire of Eventual Consistency (aka NoSQL) cast something of a shadow over SQL’s stubborn rebel alliance. But the rise of Distributed SQL made a new galaxy-wide peace at last possible — creating balance between the conflicting forces of database consistency and horizontal scalability.


    Learn SQL you shouldCopy Icon

    All through this epic saga of database developments, SQL has remained the constant guiding Force. Learn it you should, young Jedi, for the sake of the Rebellion…and also a few other very good reasons.

    1. SQL makes you a better programmerCopy Icon

    SQL has a simple structure but it can perform complex queries. By writing queries yourself you will be able to optimize retrieval for the information you need really fast, even when a super specific query requires pulling data from a bunch of different tables and then combining or reorganizing it. Most importantly this information will be structured so that you can immediately apply it: testing your application, analyzing performance, etc.

    Once you understand the basics of SQL and relational theory (it’s not that hard), you’ll find that you can continue to build on that knowledge and add features and functionality that you were relying on other tools or developers to implement.


    2. Performance gainsCopy Icon

    In any application there are three places to implement performance gains: the presentation layer, the application layer, and the storage layer. When your code is well written and well tuned, there will be few performance gains to be captured in the application layer or presentation layer. The database, on the other hand, is an easy place to make a few simple changes (add an index, change a query slightly) and see tremendous performance improvements. Modern front-end frameworks and toolkits are typically so well-written that the database is usually the first place to pluck some sweet, low-hanging performance improvement fruit.


    3. TroubleshootingCopy Icon

    Distributed applications can be dauntingly difficult to troubleshoot. The more complexity and layers that are involved, the more difficult it is to figure out what the heck is actually wrong. Whenever problems arise among the many different layers of your distributed application, understanding SQL will help you rapidly recognize and isolate those problems that happen to be occurring in the database.

    4. Work better with othersCopy Icon

    Even if you will rarely interact with a database in your daily work, learning SQL can help you do that work better. Knowing even basic SQL will help you better understand how your organization’s data is structured. It will also help with communication. When you’re communicating your goals to the DBA team (or the DBA on your cross-functional DevOps team) you’ll be able to tell them exactly what you need. Knowing SQL means having a better understanding of database architecture and the logic behind SQL queries — resulting in less miscommunication and things getting done faster.


    5. Know when to NOT do something in the databaseCopy Icon

    The database is a phenomenal tool for solving many problems. However there are many other problems where it’s the absolutely wrong tool. Learning SQL will help you make better application design decisions. The idea is to spot problems before they’re even problems but, when things do go wrong, it will help you identify and move poorly performing code out of the database.

    Once you understand SQL, you’ll have a much better grasp on the limitations of an RDBMS. You’ll know which portions of an application can safely live in a database and which will need to be moved further up the stack to a different layer. Some data validations should live with the data, some shouldn’t. Understanding how SQL works will help you determine which rules should remain in the database.

    6. SQL is everywhereCopy Icon

    Almost any software you write will need to use and display information. That information is stored somewhere, and that somewhere is (you guessed it!) in a database. And SQL is the universal language of relational data. This is why Stack Overflow’s 2021 developer survey shows SQL ranks as the third most commonly used programming language among professional developers.

    stack overflow sql

    Knowing SQL will help you be a better developer and a better teammate. It will help you build things faster, and fix them faster when they break.

    Knowing SQL means that the data Force is with you…Always.

    Use the Force, LukeCopy Icon

    Congratulations, young Padawan. You have chosen well to educate yourself in using the SQL Force. Here on the planet CoruscantDB you will study the venerable skills of database mastery. At the Cockroach University Temple, you will find the necessary knowledge and peace of mind that will ensure your success in the final test before the Jedi Council.


    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.

    Ready to begin your training, young Padawan? Cockroach University’s SQL for Application Developers is completely free, and it covers pretty much everything a developer needs to know about SQL.

    In this first course you will learn basic single-table, SQL operations. Starting from a business use case, you will learn how to translate a simple entity/object into a corresponding database table. From there, you will see how you can populate that table with data and retrieve it afterward. By the end of the course, you should feel comfortable with taking your own simple entities, mapping them to your relational database, and performing basic queries.


    The completely free self-paced SQL series continues with “how to” videos teaching you data reads and writes, schema design, modeling relationships in a SQL database, and a practical introduction to Distributed SQL. Start learning now, and in roughly ten hours you could have valuable new SQL and distributed database skills to add to your resume!

    Remember, oh Padawan, the path of the Jedi can be difficult*, but be patient. Even the great Obi-wan Kenobi needed to train. Stay with it to the end. You will become a Jedi master and you will gain recognition from others. Many will wish to consult you, sometimes offering you much in return.

    *TBH SQL is actually pretty straightforward and easy to comprehend because SQL commands are everyday English words like SELECT, CREATE, ADD and JOIN. Cockroach University can teach you the SQL basics in about an hour.

    distributed SQL
    cockroach university