INTRODUCTION TO SQL AND SQL TOOL
INTRODUCTION TO SQL AND SQL TOOL
Introduction
We will learn about SQL and SQL Commands in this tutorial.
SQL
Structured Query Language is known as SQL. In a database management system, SQL is used to build, remove, modify databases and database objects as well as to store, retrieve, and update data in databases. A database management system can be created, accessed, and modified using the standard language SQL. All current relational database management systems, including SQL Server, Oracle, MySQL, etc., support SQL.
various SQL command types
Based on their functionality, SQL commands can be divided into five groups.
DDL
Data description language is what it stands for. In the relational database management system, DDL operations like CREATE DATABASE, CREATE TABLE, ALTER TABLE, etc. are used to create and modify databases and database objects. The DDL commands CREATE, DROP, ALTER, and TRUNCATE are the most often used.
CREATE
A database and database objects like a table, index, view, trigger, stored procedure, etc. are created using the CREATE command.
Syntax
Create the table "Employee" with the columns "Id INT, Name VARHCAR(50), and Address VARCHAR(100)"
ALTER
The database object and database settings can be reorganised using the ALTER command.
Syntax
employee table changed with salary included in;
TRUNCATE
The table's whole contents can be deleted using the TRUNCATE command. The command TRUNCATE clears a table.
Syntax
Employee: TRUNCATE TABLE;
DROP
To delete the database and database object, use the DROP command.
Syntax
Employee of DROP TABLE;
DML
Data manipulation language is what it stands for. Data manipulation in a relational database management system is done using DML commands. DML instructions, such as INSERT INTO TableName, DELETE FROM TableName, UPDATE tableName set data, etc., are used to add, remove, and update data in the database system. The most often used DML commands are UPDATE, DELETE FROM, and INSERT INTO.
PLACE INTO
In order to add data to a database table, use the INSERT INTO command.
Syntax
Enter "Arvind Singh," "Pune," and "1000" into the employee's (Id, Name, Address, Salary) values field.
UPDATE
To update data in a database table, use the UPDATE command. To update a particular row, a condition can be introduced using the WHERE clause.
Syntax
Employee: UPDATE Employee SET Address to "Pune, India," Salary to "100," and Id to "1";
DELETE
Data can be deleted from a database table using the DELETE command. The WHERE clause can be used to add a condition to get rid of a certain row that matches it.
Syntax
Id = 1; DELETE FROM Employee WHERE
Delete
Data can be deleted from a database table using the DELETE command. The WHERE clause can be used to add a condition to get rid of a certain row that matches it.
Syntax
WHERE Id = 1, DELETE FROM Employee;
DQL
The letters DQL stand for data query language. The data is fetched using the DQL command. Data can be chosen from a table, view, temporary table, table variable, etc. using the DQL command. Under DQL, the SELECT command is the sole available command.
Syntax
SEARCH FOR * IN Employee;
DCL
Data control language is referred to as DCL. Access privileges to databases and database objects are granted and revoked using DCL commands. The DCL command is used to limit user access to the data. GRANT is one of the top DCL commands utilised.
GRANT
GRANT is a tool used to grant users access rights.
COM MIT
The database modification is saved or applied using the COMMIT command.
ROLLBACK
The modification can be reversed using the ROLLBACK command.
SAVEPOINT
A transaction can be momentarily saved using the SAVEPOINT command and then rolled back to this point if necessary.
Syntax
merely scribble out COMMIT, ROLLBACK, or SAVEPOINT;
Summary
We learned about SQL and SQL commands in this article.
Syntax
Grant Employee INSERT, DELETE ON User;
REVOKE
The REVOKE command cancels the user's access rights to the database object and is used to revoke such rights.
Syntax
REVOKE ALL ON USER FOR Employee;
TCL
Transaction Control Language is referred to as TCL. For managing transactions in the database, TCL commands are utilised. Data integrity in a multi-user environment is ensured by transactions. Data modification in the database can be committed and rolled back using TCL commands. The TCL commands COMMIT, ROLLBACK, SAVEPOINT, and SET TRANSACTION are the most often used.
Comments
Post a Comment