2

Question as the title says. Of course, I already tried searching online, but did not find a definite answer yet. (The sources I checked imply that the terms are interchangeable, but do not state this explicitly.)

Also, if they are not the same, then what is exactly the difference?

Some thoughts from me:

  • In theory, we could have a relational database, which is manipulated by some other language than SQL (and probably a couple instances do exist, at least at pet project level), but is there an example which is well-known and widely used in production as of today?
  • I can't really imagine how the other way round (non-relational DB manipulated by SQL) would work, but maybe it is also possible? (The closest I can think of is querying a key-value DB with SELECT and returning NULL's for the fields that are missing. But what would happen e.g. to JOIN's? So maybe a non-relational DB would be possible which works with a subset of SQL; would that still count as an SQL DB though?)
0

3 Answers 3

7

"NoSQL" doesn't consistently refer to any one concept, because it's a marketing term, not a technical one. See for instance my answer on the DBA site.

I think you have to look at the historical development of the term, rather than its face meaning: early databases were many and varied. Relational databases in their theoretical purity never actually took off, but in the form expressed by SQL they became the only game in town. So "an SQL database" for years meant "not one of those weird old-fashioned ones" - the reference was not just to the language, but to the entire philosophy it represented. Compare the term "PC", which now means neither "any computer that is personal" nor "something that is compatible with the 1981 IBM PC".

The term "relational database" was and is sometimes used as another term for this class of systems, but there are other technologies which are more relational, in the sense that they adhere to the mathematics of relational algebra or relational calculus more strictly than SQL. (For instance the SQL definition of a "table" doesn't quite match the mathematical definition of a "relation".)

Later, when variety and experimentation became fashionable again, the "SQL" label was the obvious one to contrast with, hence "NoSQL". Again, it didn't actually mean "no use of the language SQL", it meant "something other than the class of database that's become ubiquitous".

There are absolutely ways of building a database which are not relational, but can be queried using SQL, or something very like it. A lot of analytical databases and "Big Data" tools do exactly this - they convert the familiar query terms into operations on some completely different data store - e.g. column-based database, or an indexed "data lake".

As I said on the linked answer, the only value of the term "NoSQL" is as a reminder that "SQL-relational" is no longer the only option you have. As a category, it's about as specific as "non-human".

0
2

Unfortunately, yes, they largely do. The common point of most systems that call themselves "NoSQL" is not so much that they don't have a structured query language (many do have query languages, and some of them aren't actually all that different from SQL), but that they don't enforce a rigid schema on the data they contain.

Why exactly the term 'NoSQL' took off instead of something to do with schemas is hard to tell. Possibly the very success of the relational data model made the idea of abandoning SQL, which seemed inextricably linked to them, look so revolutionary as if that were the primary change.

2
  • From the standpoint of application developers that do not like dealing with SQL, the fact that SQL was no longer the part of the equation was the major change. Especially if the developers relied on DBAs for anything database-related. SQL was their only exposure to databases. Commented Oct 15, 2021 at 22:20
  • @GregBurghardt I think it was more a case of "you don't need SQL" than "you don't have to deal with SQL" - early "NoSQL" databases often had rather weak querying capabilities, but justified that by claiming other advantages. If it was the case that developers don't like SQL as a language, it would have been much easier to build a new query language on top of an existing back-end; instead, the opposite has happened - SQL front-ends have been built for radically different back-ends, because SQL is familiar to people.
    – IMSoP
    Commented Oct 17, 2021 at 16:05
2

Yes, that's how I understand and use the terms. Non-relational is actually a slightly better term for this mainly because SQL is a language, not a data storage architecture. I feel both terms are flawed, though, in that they describe what something is not instead of what it is.

There are alternate query languages for relation DBs. For example Google has one called Logica that works with its BigQuery database.

Additionally there are non-relational DBs that support SQL such e.g. GraphDB.

12
  • > There are alternate query languages for relation DBs. Wouldn't this change the answer to the question to "no, they are not the same"? Logica would then be an example of NoSQL database which is relational (i.e. not non-relational). (And same for GraphDB which is non-relational, but "not NoSQL")
    – Attilio
    Commented Oct 15, 2021 at 16:12
  • 2
    @Attilio Logica is a language, not a DB, and it actually compiles to SQL. The database is called BigQuery and I believe it is relational but I don't know much about it really. But the term 'NoSQL' is used for graph DBs even if they do support SQL. NoSQL is an imprecise/inaccurate term which is why I think 'non-relational' is better.
    – JimmyJames
    Commented Oct 15, 2021 at 16:18
  • In some ways, SQL is an architecture, because it defines a lot of concepts we expect to exist in all such systems (tables, columns, result sets); those aren't quite the same as the concepts originally proposed for "relational" databases, so purists would argue that an "SQL DBMS" is not actually a "relational DBMS". I guess most "NoSQL" systems are "not even remotely relational", though, so perhaps "non-relational" does work.
    – IMSoP
    Commented Oct 15, 2021 at 18:00
  • @IMSoP I guess what I mean by that (other than the obvious 'L' stands for language) is that you could create a relational database and not support SQL at all. The example of BigQuery/Logica kind of falls flat because they are simply transpiling to SQL from Logica but I think it's easy to see that you could have a relational DB where you use something like Logica (i.e. a Prolog/Datalog derivative) as the primary or sole query language. The term NoSQL took off because of a backlash against SQL, which I get, but I still think it's flawed and I'm sure I'm not the only one.
    – JimmyJames
    Commented Oct 15, 2021 at 20:16
  • @IMSoP Not trying to spam you here but I really think this article hits the nail on the head: "The main flaw of SQL, however, lies in its very limited support for abstraction." This is what, I think, is the root of the backlash against SQL and the genesis of the 'NoSQL' moniker.
    – JimmyJames
    Commented Oct 15, 2021 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.