Structured Query Language (SQL)
Structure Query Language is the universal standard database language for accessing and managing data in the database. At first SQL was called ‘SEQUEL’ which means ‘Structured English Query Language’ and it was designed and implemented at IBM Research for relational database system. SQL-92 is the certified version of SQL by ANIS and ISO. Different companies have used SQL for their relational database. For example, Microsoft has used SQL as T-SQL for SQL Server, Oracle has used SQL as P-SQL etc.
SQL provides an interface where user can specify `what` are the expected results? The query execution plan and optimization is performed by the DBMS. The query plan and optimization determine how a query needs to be executed. SQL is a non-procedural language as it just specifies what is to be done rather than how it is to be done. It is also a high level query language, so it is closer to a language like English. Therefor it is very user friendly.
SQL is the comprehensive database language which allows the user to query a database without getting depth knowledge of the design of the underlying tables. SQL has statements for data definition, data manipulation and data control. A query is a request to the DBMS for the retrieval, modification, insertion and deletion of the data from the database.
‘SELECT rollno, name, phone from student where class =12’ is an example of SQL query which displays the roll no, name and phone of the students who study in class 12.
Some of the important features of SQL are:
It is a non procedural language.
It is English like language.
It can process a single record as well as sets of records at a time.
It is 4 GL as all SQL statements define what is to be done rater than how it is to be done.
SQL is a data sub-language consisting of there built in language: Data Definition Language (DDL), Data Manipulation Language (DML) and Data Control Language (DCL).
It insulates the user from the underlying structure and algorithm.
It has the facilities for defining database tables, views, security, integrity, transaction control, index etc.
SQL has different statements for DDL, DCL and DML.
DCL
DCL stands for ‘Data control Language’ and DCL statements are used to change the permission associated with a database user or role. DCL contains the commands that allow system and data privileges to be passed to various users. The DCL commands are normally available to data base administrator. The DCL statements are Grant, DENY and REVOKE.
DDL
DDL stands for ‘Data Definition language’ and DDL statements are used to create, modify and drop database and database objects like table, user-defined data types, index, views etc. CREAT, ALTER and DROP are the DDL statements of SQL. Create is used to make new database objects, ALTER is used to modify the existing database objects and DROP is used to remove the unnecessary objects from the database.
DML
DML stands for ‘Date Manipulation Language’ and DML statements are used to work with data in the database. The DML statements are ‘SELECT’, ‘INSERT’, ‘UPDATE’ and ‘DELETE’. The DML statements are used to retrieve required data from database, to insert (add) new data into database, modify existing data and delete unnecessary data from the database.
0 Comments