Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.75 KB

File metadata and controls

40 lines (27 loc) · 1.75 KB

SQL Dialects

Each database engine has its own SQL dialect. Different databases understand the general grammatical flow of Structured Query Language, but, like spoken languages, there are many unique dialects.

Take Postgres and Microsoft SQL server as examples.

Microsoft uses this syntax to limit records to 10 results

SELECT TOP 10 name FROM some_table

Postgres uses similar, but slightly different syntax to generate the same output

SELECT name FROM some_table LIMIT 10

You don't need to be fluent in either dialect to intuit the similarity. Both dialects begin with a SELECT statement, scan the some_table, project the name column, and, with subtle differences, limit the record count to 10

In this project in particular, the most basic grammar is used. The grammar is closest to an ANSI SQL standard

Should this project grow, it would make sense either to adopt the grammar of an existing engine, or, more logically, create a unique grammar. If, for example, the code were extended to include custom .NET code that interprets custom functions to execute in C#, the grammar would then be unique to the implementation.

The SQL Parser project supports injecting custom grammars, so generating a custom grammar is a simple task.


Continue Reading

  1. Data Types
  2. Data Sources
  3. Logical Plans
  4. Physical Plans
  5. Query Planning
  6. Query Optimization
  7. Query Execution
  8. Async Enumeration
  9. Rows vs. Columns
  10. SQL Dialect