Tag: SQL

  • Visualizing SQL

    While I think SQL is interesting, I know some people struggle with the way the language work. Someone at work posted a link to this site: https://animatesql.com/

    I think the idea is this site helps you visualize how a SQL query works. It’s not free form, and I can’t just write any SQL, but you choose a keyword and then a sample query is shown. If you press Visualize, it walks through how this query is processed.

    Below, I choose the WHERE keyword and then pressed visualize. The sample query had a NOT before the parenthesis, which I removed.

    2022-03-30 09_13_50-Animate SQL

    The animation then works through each row, showing whether it fits the criteria. Here I have captured what things look like in the middle:

    sqlviz

    Eventually this goes through the process again with the SELECT part of the query and pulls results from the yellow rows, according to the columns listed in the query.

    If you try the different keywords, you see different visuals and queries. You can modify them slightly, and the comments in the query window let you know what you change. The modifications are small, but they do let you see how well things work in different ways, such as if you change the value or remove a logical operator, as I did.

    As I tried a few different items, it made sense to me, but I wonder if it would for someone that was learning. I think that this ought to have some explanation of what is happening (i.e. comparing the name and rating in each row to be null or not, and matching the criteria). For the GROUP BY, I really think someone might not understand what they are seeing without some explanation.

    I also think the lack of NULL in the data, and showing a blank, is highly misleading as well.

    This looks like something a developer built, and I think it is creative and helpful, but like many 1.0 things, this needs some evolution and improvement.

  • This Made Me Laugh: SQL v NoSQL

    It’s a humorous history lesson on SQL (and product promotion), but it opens like this:

    battle

    SQL awakens to fight the dark forces of NoSQL

    From there it looks at the beginnings of SQL and the growth of NoSQL, going through a few sections, like

    newhope

    Part 1: A New Hope

    and

    strike

    Part 2: NoSQL Strikes Back

    before moving to

    return

    Part 3: Return of the SQL

    They finish with the idea that SQL is the most important, and common, tool for data analysis. In this era of Python and R, many may disagree, but I think they’re overall right.

    Perhaps this last part proves that?

    yoda

    Master Data Scientist Yoda

    It’s an interesting read, and I may have to watch some Star Wars this weekend.

  • The 43rd Birthday for SQL

    I ran across a neat post that reminded me that SQL is 43 this year. It first appeared in 1974, and not only is it still in use by many of us on a daily basis, it’s the second most common language in the Stack Overflow developer survey. Only Javascript is more commonly used, which is also somewhat amazing. Maybe Javascript really is taking over the world.

    I’m not surprised that SQL is so heavily used (half the developers report it’s one of their languages), since almost every application needs to query data from a database. Whether you use a relational store or not, SQL is likely your language of choice. Many NoSQL database technologies have bolted some SQL query capabilities onto their systems precisely because SQL is handy and helpful in sifting through lots of data.

    I think SQL is a mess of a language in many ways. The DDL is poorly crafted, and even the DML reads funny to me. The order of operations is nothing like the structure of the query. I’d expect more of a LINQ like syntax (where is the data coming from first) that logically flows the query from data to result. I’m sure that will not change anytime soon since we’re so used to the SQL language. Even those developers that like to write in LINQ really need to know SQL in order to check their queries against back end systems. The survey of loved languages backs up the idea that SQL isn’t great it falls far behind many other languages. However, many of those are more modern languages that provide more convenience and help. SQL is fairly bare bones, with rather immature tooling for a 43 year old.

    SQL Server is also doing well, showing up in almost a third of developers’ work, ahead of PostgreSQL, Oracle, and beaten out by MySQL. That’s a testament to the power, ease, and feature rich nature of SQL Server. I wonder if the release of SQL Server on Linux will grow these numbers. My thought is that those companies using another platform on Linux might consider SQL Server instead, perhaps because the robust nature of the platform along with the ease of development may get more people to try it. We’ll have to check back in a year.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 3.5MB) podcast or subscribe to the feed at iTunes and Libsyn.