ADD

Wednesday, 18 May 2016

DBMS LANGUAGES

DATABASE LANGUAGES

A DBMS Provides two types of languages : 
  1.  Data - Definition Language - to define the data in the database.
  2. Data - Manipulation Language - to manipulate the data in the database.
Data - Definition Language (DDL) 
       The language used to define the data in the database is called as Data - Definition Language (DDL). In simple words, Data Definition Languages is used to create the database, alter the database and delete the database. The result of compilation of Data-Definition Language statements is a set of tables that is stored in a special file called data dictionary or data directory.A data dictionary is a file that contains metadata - that is, data about data. This file is consulted before actual data is read or modified in the database. This DDL is used by the conceptual schema to store (define) or retrieve (query) the records to/from the database respectively, where these records describes everything, i.e., entities, attributes and relationships.
There is yet another Data Definition Language - the Internal DDL or also known as data storage and definition language used by Internal schema which describes how data is actually stored. The result of compilation of the statements of this language specifies the implementation details of the database schemas - details  are usually hidden from the users 
            DDL commands are create,Alter and Drop only.


Data - Manipulation Language (DML)
The language used to manipulate the data in database is called Data - Manipulation Language (DML). In simple words, Data - manipulation Language is used to retrieve the data from the database, insertion of new data into the database & deletion or modification of existing data.
        The operation of retrieving the data from the database using DML is called as a query.
Simply we can say that, A query is a statement in the DML that requests the retrieval of data from the database. The portion of DML used to pose a query is known as query languages. We can use the terms query language and data - manipulation language synonymously.  The query language contains commands to select and retrieve the data from the database. Commands are also provided to insert, update & delete the records.
     Even, the  pre - defined data - manipulation functions are provided by the DBMS which can be called into our programs directly by their names i.e., procedure calls. 

A DML Manipulation the data basically in two types :
  1.      procedural DMLs
  2.  Non - procedural DMLs
  • Procedural DMLs makes a user to specify two things. one is what data is to be retrieved and the second is to tell be procedure to how to get those data. 
  • Non - procedural DMLs makes a user to specify only one thing, that is, what data is to be retrieved i.e., without telling the procedure to how to get that data.  
NOTE : Non - procedural DMLs are easier to learn and use than procedural DMLs BUT procedural language is more efficient than non - procedural language because it specifies the procedure to retrieve the data.

Data Sub - Language 
The DDL and DML are collectively referred to as the data sub - language when embedded within a host language (Example : Cor COBOL etc).

Host Language 
      A relational DBMS supports an interactive SQL interface and users can directly enter SQL commands. This simple approach is fine as long as the task at hand can be accomplished entirely with SQL commands . In practice we often encounter situations in which we need the greater flexibility of a general - purpose programming language, in addition to the data manipulation facilities provided by SQL. For example, we may want to integrate a database application with a nice graphical user interface. To deal with situations, the SQL standard defined how SQL commands can be executed from within a program in a host language such as C or JAVA, the use of SQL commands within host language program is called embedded SQL or the statement (i.e.,not deceleration) can be used wherever a statement in the host language is allowed (with few restrictions). Of course, SQL statement must be clearly marked so that a preprocessor can deal with them before invoking the compiler for the host language. Also, any host language variable used to pass arguments into an SQL command must be declared in SQL. 
          SQL and QUEL only provide facilities to define and retrieve data. To extend the data manipulation operations of this languages, for example to separately process each type of relation, these languages have to used with a traditional high - level language. such a language is called a host language and the program is called the host program.


6 comments: