Experimental Query Language Comparison

A comparison of experimental query languages. The example numbering is based on QueryLanguageComparison.

Motivation for this topic is covered in ExperimentalQueryLanguageDiscussion.


Experimental Query Languages:


Example 1: Retrieve all columns/attributes and rows/tuples from a table/RelVar

SMEQL (TqlRoadmap):

 calc(myThings, [])
 // or
 filter(myThings, 1=1)

Example 2: Restriction

SMEQL:

 filter(myThings, name='blah')

Example 3: Restriction and projection with unique result

SMEQL:

 T1 = filter(myThings, name='blah')  
 T2 = calc(T1, [A, B, C])
 unique(T2)
 //
 // nested style
 //
 unique(calc(filter(myThings, name='blah'), [A, B, C]))

Example 3b: Restriction and projection without required uniqueness

SMEQL:

 T1 = filter(myThings, name='blah')  
 calc(T1, [A, B, C])
 //
 // nested style
 //
 calc(filter(myThings, name='blah'), [A, B, C])

Example 4: Aggregation

SMEQL:

 group(sp, [snumber, count() p_count])

Example 5: Insertion

SMEQL:

 insert(myThings, [(1)a,(2)b,(3)c,('glub')name])
 insert(myThings, [(4)a,(5)b,(6)c,('glob')name])
Example 6: Table/relvar creation

 create("myThings", dataDictionaryTable)
Example 7: Transitive closure or recursion - "all paths" of a digraph

Example 8: Natural equi-join

SMEQL:

(No current natural join. Predefined "join dictionary" recommended instead. See TqlChainedJoin.)

Example 9: Equi-join

SMEQL:

 J = join(red, blue, a.x = b.y)
 Calc(J, [foo, bar])
Example 10: Equi-join with same-named key

SMEQL

 J = join(red, blue, a.x = b.x)
 Calc(J, [foo, bar])

Example 11: Top 3 largest planets, use name if tie

SMEQL

  sized = orderBy(planets, [desc(diameter), name], sequence)
  filter(sized, sequence <= 3)


See also ConceptualQueryExampleOfAdvantages


CategoryQueryLanguage, CategorySpeculative


EditText of this page (last edited June 27, 2013) or FindPage with title or text search