top of page
Writer's pictureanisa mumtaz

INTRODUCTION TO SQL



What is SQL?

SQL is the short form of Structured Query Language. SQL is a language used to access the data and structures in a database. Database is an electronically stored collection of data. In simple words SQL is used to communicate with the database.

DATABASE USER


Like shown in the figure, the user will send queries to the database and will receive answers from the same. This exchange is done with the help of Structured Query Language.

 

Different datatypes in SQL are:-

VARCHAR: Used for storing variable-length characters.

CHAR: Used for storing fixed-length characters.

NUMBER: Used for storing numerical values.

DATE: Used for storing time and dates.

BLOB: Used for large files, such as Pictures. 


For explaining VARCHAR AND CHAR in detail,

In VARCHAR - we can use characters with variable length, like,

      names- ‘Sara’ or ‘Thomas’, have different lengths.

      places- ‘Kochi’ or ‘Kolkata’ also have different lengths.

In CHAR - we can only use characters with fixed length, like

      gender- ‘M’ or ‘F’ with size = 1

      Boolean- ‘YS’ or ‘NO’ with size = 2

      Boolean- ‘YS’ or ‘NO’ with size = 2

 

What Is A Table In SQL?

For understanding the concept of SQL, we need to have a new understanding of the term ‘table’. A relational database system has one or more objects, and that is known as a table.

  Eg. for a table in SQL


In a table, data is organized in rows and columns similar to a spreadsheet. In DBMS terms, we also call tables as relation and row as tuple. Rows contains the data itself and columns has the list of what will be stored like for example, name, age, place etc.

 

What Are The Categories Of SQL?

DDL - Data Definition Language, commands like CREATE, ALTER etc.

DML - Data Manipulation Language, commands like UPDATE, INSERT, DELETE etc.

DCL - Data Control Language, commands like GRANT, REVOKE etc., are used for restricting access to data

TCL - Transaction Control Language, commands like COMMIT, ROLLBACK etc., are during a transaction , where,

                 COMMIT - to make the changes made by the transaction permanent

                 ROLLBACK - cancels all the changes made by the transaction.

 

In conclusion, SQL is a language which can be used for communication between the user and the database. It can also be used for handling large datasets and various database systems.

Comentarios


bottom of page