Search code examples
sqldatabasemdxgraph-databasesdatabase-theory

Groupings of queries


I would like to understand what might be the highest-level groupings of how query languages can be broken up into, and why one grouping might be fundamentally different than another. For example, the groupings that I have come up with now (for general-purpose usage) are:

  1. Relational
    Example: SQL
  2. Document
    Example: XQuery, JSONPath, MQL (mongoDB)
  3. Graph
    Example: Cypher (Neo4j)
  4. Other possibilities (?)
    Dataframe/pandas? multidimensional (MDX)?

What might be the best high-level grouping to describe various query languages?


Solution

  • One variant is to group the query language depending on the database categories.

    • relational (Microsoft SQL Server, Oracle, MySQL, MariaDB)
    • object-relational (PostgreSQL)
    • NoSQL
      • Key-value (Riak, Redis, Couchbase Server, MemcacheDB)
      • Columnar (HBase)
      • Document (MongoDV, CouchDB)
      • Graph (Neo4j)

    So far, so good, but in reality the border line between the categories become thinner and thinner.

    For example, we have graph support in Microsoft SQL Server and T-SQL we have syntax like the following:

    -- Find Restaurants that John's friends like
    SELECT Restaurant.name 
    FROM Person person1, Person person2, likes, friendOf, Restaurant
    WHERE MATCH(person1-(friendOf)->person2-(likes)->Restaurant)
    AND person1.name='John';
    

    In MongoDB, we have graph,too using graph lookup:

    {
       $graphLookup: {
          from: <collection>,
          startWith: <expression>,
          connectFromField: <string>,
          connectToField: <string>,
          as: <string>,
          maxDepth: <number>,
          depthField: <string>,
          restrictSearchWithMatch: <document>
       }
    }
    

    So, maybe the the highest-level grouping is just a group of database management system following the American National Standards Institute (ANSI) standards (relational and object-relational) and the others.