Thursday, October 27, 2022

what is SQl

 What is  SQL 

SQL stands for Structured Query Language, and is used to communicate with a relational database.

It's the standard language for relational database management systems.

SQL statements are used to perform task such as update data in a database, or retrieve data from a database. Some common relational database management system that usd Sql include microsoft Sql Server, MySQL, postgreSQL,

MariaDb,and Oracle


                                       




History Of SQL

SQL was originally standardized by the American National Standards Institute (ANSI) in 1986, and by the International Organization for Standardization (ISO) in 1987. Since then, the standard has been extended several times as relational database vendors have added new features to their systems. Additionally, most database vendors include their own proprietary extensions that are not part of the standard, which has resulted in a variety of dialects of SQL


You can use SQL statements such as SELECTINSERTUPDATEDELETECREATE, and DROP to accomplish almost everything that you need to do with a database. 

PostgreSQL and MySQL also have their own versions of these features.

Some popular dialects of SQL include:


  • Transact-SQL (T-SQL). This version of SQL is used by Microsoft SQL Server and Azure SQL services.

  • pgSQL. This is the dialect, with extensions implemented in PostgreSQL.

  • PL/SQL. This is the dialect used by Oracle. PL/SQL stands for Procedural Language/SQL.


SQL statement types

SQL statements are grouped into three main logical groups:

  • Data Definition Language (DDL)
  • Data Control Language (DCL)
  • Data Manipulation Language (DML)
  • Data Query Language  (DQL)
  • Transaction Control Language (TCL)

DDL Command

You use DDL statements to create, modify, and remove tables and other objects in a database (table, stored procedures, views, and so on).

The  most common DDL  Command are;

Commands        

CREATE :  ( Create a new object in the database. such as a table or a View. )

ALTER  :  ( Modify the structure of an object. for instance altering a table to add a new column )

DROP : ( Remove an Object from the database)

RENAME  : (This is used to rename an object existing in the database) 



DCL Command

DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system. 

The  most common DCL  Command are;

Commands                    

GRANT : ( Grant Permission to perfome specific actions )

DENY    : ( Deny permission to perfome specific actions )

REVOKE  : ( Remove a Previously granted permission )


SQL

GRANT SELECT, INSERT, UPDATE

ON Product

TO user1;

DML Commands

You use DML statements to manipulate the rows in tables. These statements enable you to retrieve (query) data, insert new rows, or modify existing rows. You can also delete rows if you don't need them anymore.
it is the Component of the SQL Statement that onttrols access to data and  to the database. Basically,
DCL Statements are grouped with DML Statments.

The four main DML statements are:


Commands                                    
SELECT  :  ( Read rows from a table )

INSERT     : ( insert new rows into a table )

UPDATE    : ( Modify Data In Existing Rows )

DELETE     : ( Delete Existing rows )                           
 


DQL Commands

DQL statements are used for performing queries on the data within schema objects. The purpose of the DQL Command is to get some schema relation based on the query passed to it.
 We can define DQL as follows it is a component of SQL statement that allows getting data from the database and imposing order upon it. It includes the SELECT statement. This command allows getting the data out of the database to perform operations with it. When a SELECT is fired against a table or tables the result is compiled into a further temporary table, which is displayed or perhaps received by the program i.e. a front-end.


List of DQL

  • SELECTIt is used to retrieve data from the database


TCL Commands

In SQL, TCL Stands for Transaction Control Language 
  • A single unit of work in a database is formed after the consecutive execution of commands is known as a transaction.
  • There are certain commands present in SQL known as TCL commands that help the user manage the transactions that take place in a database.
List of  TCL

COMMIT. ROLLBACK  and SAVEPOINT are the most Commonly used TCL Commands in SQL.

COMMIT command in SQL is used to save all the trasaction- related change  permanently to the disk. whenever DDL commands such as INSERT< UPDATE and DELETE are used the changes made bythese commands are permanent only after closing the current session.  so before closing the  session , one can easily roll back the changer Made by the DDL commands.  Hence, if we want the change to be saved permanently to the disk without closing the session , we  will use the commit command.






















                         

     













                                  








No comments:

Post a Comment

Python