Declarative languages, also called nonprocedural or very high level, are programming languages in which (ideally) a program specifies what is to be done rather than how to do it. In such languages, there is less difference between the specification of a program and its implementation than in the procedural languages described so far. The two common kinds of declarative languages are logic and functional languages. It is a programming paradigm— a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow. Many languages that apply this style, attempt to minimize or eliminate side effects by describing what the program must accomplish in terms of the problem in the domain, rather than describe how to accomplish it as a sequence of the programming language primitives. This is in contrast with imperative programming, which implements algorithms in explicit steps.
Declarative programming often considers programs as theories of formal logic, and computations as deductions in that logic space. Declarative programming may greatly simplify writing parallel programs. Common declarative languages include those of database query languages (e.g., SQL, XQuery), regular expressions, logic programming, functional programming, and configuration management systems.
All logic programming languages can be generalised into a category of programming languages, called declarative languages. They share the same idea of analysing computations. The computation is satisfied by specifying the properties of the correct answer. Logic programs can be interpreted using two main concepts: truth and logical deduction. Truth derives whether or not the computation in the program is true, under the implementation of the program symbols. Logical Deduction determines whether a logical clause is a consequence of the program. All logical programming languages have exact operational meaning and most support the processing of finite sets. The programs themselves are instructions for execution by a compiler. These instructions are always interpreted as logical statements and clauses, and the result of the execution is a logical consequence of the computations in it.
Functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that each return a value, rather than a sequence of imperative statements which change the state of the program. This allows programs to be written in a declarative and composable style, where small functions are combined in a modular manner. Functional programming is sometimes treated as synonymous with purely functional programming, a subset of functional programming that treats all functions as deterministic mathematical functions, or pure functions. When a pure function is called with some given arguments, it will always return the same result, and cannot be affected by any mutable state or other side effects. This is in contrast with impure procedures, common in imperative programming, which can have side effects (such as modifying the program's state or taking input from a user).
A database language is a repository of information managed by a database engine that ensures the integrity of data and fast access to the data. A very common implementation of a database is a Relational Database Management System (RDBM). To users, the information in a database can be accessed by using Structured Query Language (SQL) a database language common to most databases. However, SQL only provides commands to access and manipulate the data in the database. For any complex application, there commonly is a need for conditions, branching, and loops. None of these is a part of the SQL language. In order to fill this gap, many common programming languages allow integration with SQL through a common library such as Open Database Connectivity (ODBC), Object Linking and Embedding (OLE), and sometimes with application programming interfaces or libraries supplied with the database.