Deleting Single Record
You can delete the records named Rithvik by using the below query:
Query
DELETE FROM GFG_Employees WHERE NAME = 'Rithvik';
Output
SQL DELETE Statement
SQL DELETE is a basic SQL operation used to delete data in a database. SQL DELETE is an important part of database management DELETE can be used to selectively remove records from a database table based on certain conditions. This SQL DELETE operation is important for database size management, data accuracy, and integrity.
Syntax:
DELETE FROM table_name
WHERE some_condition;
Parameter Explanation
- Some_condition: condition to choose a particular record.
- table_name: name of the table
Note: We can delete single as well as multiple records depending on the condition we provide in the WHERE clause. If we omit the WHERE clause then all of the records will be deleted and the table will be empty.
The sample table is as follows GFG_Employees:
Query:
Assume we have created a table named GFG_Employee which contains the personal details of the Employee including their id, name, email and department etc. as shown below −
CREATE TABLE GFG_Employees (
id INT PRIMARY KEY,
name VARCHAR (20) ,
email VARCHAR (25),
department VARCHAR(20)
);
INSERT INTO GFG_Employees (id, name, email, department) VALUES
(1, 'Jessie', 'jessie23@gmail.com', 'Development'),
(2, 'Praveen', 'praveen_dagger@yahoo.com', 'HR'),
(3, 'Bisa', 'dragonBall@gmail.com', 'Sales'),
(4, 'Rithvik', 'msvv@hotmail.com', 'IT'),
(5, 'Suraj', 'srjsunny@gmail.com', 'Quality Assurance'),
(6, 'Om', 'OmShukla@yahoo.com', 'IT'),
(7, 'Naruto', 'uzumaki@konoha.com', 'Development');
Select * From GFG_Employees
Output