DDIA | Chapter 2 | Data Models and Query Languages | Query Languages for Data

There are broadly two methods to execute queries in database – 

  1. Imperative – in this, code tells computer to perform certain operations in sequence. Most of the programming languages are imperative.
  2. Declarative – in this method, one specifies the pattern of data needed, rest all is taken care by query optimizer. Most of the SQL languages are declarative. It is easier to work with, hides database engine’s implementation details. Also these languages support parallisation across multiple machines.

MapReduce Querying – 

  1. Neither imperative, nor declarative, combination of two.
  2. It is based on the map (also known as collect) and reduce (also known as fold or inject) functions that exist in many functional programming languages.
  3. Map and reduce are pure functions, which means they only use the data that is passed to them as input, they cannot perform additional database queries, and they must not have any side effects. 

Thanks for stopping by! Hope this gives you a brief overview in to query languages for data models. Eager to hear your thoughts and chat, please leave comments below and we can discuss.