SQL: Introduction
- Categories DBMS, Data Management, Database
In this post we will learn about SQL or Structured Query Language
SQL is short for Structured Query Language which is a standard Database language used to create, maintain and retrieve data in a relational database.
It was initially developed by IBM, however over the years many companies like Microsoft have added their extensions or introduced variants.
The Advantages of SQL are that
- It is easy to learn & understand
- It is portable and is widely supported.
- It can run at high speeds
The disadvantage is that due to different vendor versions, SQL Versions are not portable across vendors. Depending upon the RDBMS you are using, the commands could have minor variations.
We are going to learn how to write queries or commands to work with relational data bases.
Some basic rules for the SQL Statements or Commands are:
- SQL Statements are not case sensitive
- Statements can span across multiple lines but words cannot
- Any non-numeric data such as Name or date need to be enclosed in single quotes (‘ ’)
- Semicolon (;) is used to terminate SQL statement
The queries or commands we are going to write are divided into 4 basic types.
- Data Definition Language: It is used create and maintain the database and tables itself. e.g; CREATE TABLE, ALTER TABLE, DROP COLUMN and so on.
- Data Control Language: It is used for access control of tables and transaction control language for this we used commands like GRANT and REVOKE.
- Data Manipulation Language: Once the database and its tables are created, DML queries are used to actually insert/update and delete data in the relations. e.g. commands like INSERT, DELETE, UPDATE.
- Data Query Language: It is used to extract the data from the relations. e.g.; SELECT
DML and DQL are the commands which you as an application programmer will mostly use, while DDL and DCL is something which will be taken care of by Database Administrator.
Check out our video: https://youtu.be/kamoCcaQvFg