Generally, we use the language for Communication and if we talk about our system then in the system, on one side, there are users and on the other side, there are databases.
How will the user interact with the database?
The user will communicate with the database using the Structured Query Language.
Whenever we store the structure data, we use the Tables or relations. Sometimes we call this a Relational Database Management System. We always store the data in the form of a relation or table. So whenever we have to put any query on structured data, we have to fetch the data, or store the data, then we use the SQL (Structured Query Language)
Basics of Structured Query Language
What is the domain-specific language?
There are two types of languages, Domain-specific, and General-purpose.
General Purpose: means its applicability exists in multiple places, like C, and C++ language. It can not be used in one place, you can use it in multiple areas.
Domain Specific: SQL is Domain-specific because we can use only structure data, which means only inside the relational database, we can use only SQL. Where we have our data in the form of a Table and we have to fetch the data, then we can use SQL but there is no general use of SQL. So it’s a particular domain that we use and that domain is the Relational Database that’s why we call it Domain Specific Language.
SQL is a Declarative Language
There are two categories: Declarative and Procedural
What is Declarative?
It means What to do and What to do means, let’s say we have to find out the name of the student, who belongs to Chandigarh, so the students who do belong to Chandigarh, need to fetch their records. Then we write a simple query like SELECT * FROM STUDENTS WHERE ADDRESS= ‘CHANDIGARH’; but how does it work internally, That is Database, it works on its end. That means, What to do is mentioned here, but how to do it, we don’t mention it. So that’s why we call it a Declarative Language
- Data Definition Language (DDL)
- Data Manipulation Language (DML)
Data Definition Language (DDL) Commands
Create Command: DDL Commands deal with Schema and here Schema is the Structure and the Structure means Table. Data that we need to store, we store in the form of Tables. So it deals with the creation of that Table.
Alter Command: If we need to change anything in the Table, like – changing the data type of the Table or adding a Column inside the Table, Deleting a Column, means whatever has to be changed in the Table or Structure that we do with Alter command.
Drop Command: If we want to remove the table then we use the Drop command.
Truncate Command: If we want to remove data from inside the Table then we use the Truncate command.
Rename Command: If we want to change the name of the Structure then we use Rename command.
Data Manipulation Language (DML) Commands
Select Command: If we need to select the data from the database then we use the SELECT statement.
Insert Command: If we need to insert the data from the database then we use the INSERT INTO statement.
Update Command: If we need to update the records from the database then we use the UPDATE statement.
Delete Command: If we need to delete the data from the database then we use the DELETE statement.
StudySection gives an opportunity to beginners and experts in .NET framework to go through StudySection’s .NET Certification Exam and get a .NET certification for enhancement of career in programming. If you have knowledge of the .NET framework then you can get a certificate through an online exam at StudySection.