Introduction to Structured Query Language (SQL)
Structured Query Language (SQL) is a standard Database language which is used to create, maintain and retrieve the data from relational database like MySQL, Oracle, SQL server, etc. It was developed by Donald Chamberlin and Raymond Boyce in the year 1974.
SQL is a standard language for Relational Database System. SQL was one of the first commercial language and becomes the most widely used database language. SQL is a programming language for rational databases. The program of SQL to control the database is called as database management system.
SQL using in a websites to use as a server-side scripting language, to get the data you want, to retrieve data from the database and to make data request.
Functions of SQL:
The functions of SQL are as given below:
- Creation of database.
- Modification of database.
- Deletion of database.
- Retrieving the information into the database.
- Displaying the information into the database.
- Modification of information from the database.
Components of SQL:
SQL contains various types of statements for different purposes. SQL statements are divided into the four categories are as follows:
- Data Definition Language (DDL)
- Data Manipulation Language (DML)
- Data Query Language (DQL)
- Data Control Language (DCL)
1. Data Definition Language (DDL):
Data definition language is used to design of the database is called database schema. It is used to create, alter and delete database objects. The data definition statements are CREATE, ALTER, DELETE.
2. Data Manipulation Language (DML):
Data manipulation language statements are used most frequently in SQL statements. It is used to insert, modify and delete the data in the database. The data manipulation statements are INSERT, UPDATE, and DELETE, SELECT.
3. Data Query Language (DQL):
Data query language is one of the most commonly used in the SQL statements. It is used to enable user to query one or more table to get the information they want. The data query has only one statement is SELECT.
4. Data Control Language (DCL):
Data control language consists of control that user access to the database objects. The data control statements consists of SAVE POINT, COMMIT, REVOKE, ROLLBACK.
Domain (Data) Types in SQL:
When any of the user want to store a constant value into a column of a table, then a column must be declare a particular keyword called as data type. Following are the various domain (data) types are available in SQL are as given below:
CHAR: It is a fixed length character string with user specified length. It can store an alphanumerical value.
VARCHAR: It is a variable length character string with user specified maximum length. It is also store an alphanumerical value.
INTEGER: It is a data type which is used to store a numerical value.
NUMBER: It is a data type which is used to store a numerical data either integer or real numbers.
DATE: It is used to store a date containing year, month and day of a month.
TIME: It is used to store a time of day in seconds, minutes and hours.
FLOAT: It is used to store a floating point number, with precision of least digits.
NULL: It is a data type which is used to declaring a column in table.
Applications of SQL:
The main applications of Structural Query Language (SQL) are as given below:
- It is use to allow users to access data in the relational database management system.
- It is use to allow users to define data in database and manipulate that data.
- It is use to allow users to create and drop database and tables.
- It is use to allow users to describe the data.
- It is used for modification of the index structures and database table.
- It is used for web pages which can extract data from SQL databases.