In my previous video of mysql series I have discussed about alter command in details
Today I am going to discuss about the difference between drp and delete statement in mysql
So without any further delay let's get started
Delete statement
● DELETE is a Data Manipulation Language (DML) Command
● It is used to delete one or more tuple from the table
● By using DELETE command we can either delete all rows at once or can delete it one by one
● It is comparatively slower than TRUNCATE command
● DELETE command is Transaction Safe.
SYNTAX:-
TO DELETE ALL THE ROWS FROM THE TABLE
DELETE FROM table_name;
TO DELETE ONE ROW UNDER SOME CONDITION
DELETE FROM table_name WHERE condition;
Let's understand this with an example
I am using customers table under product database
Let's delete all the details of customername AlfredosMoreno
So the syntax will be
DELETE FROM customers
WHERE CustomerName='Alfredos Moreno';
To delete all rows from the table
DELETE FROM customers ;
NOTE THAT
● ON DELETION OF ALL THE ROWS FROM THE TABLE, THE SCHEMA OF THE TABLE REMAINS THE SAME.
● HERE WE CAN USE 'ROLLBACK ' COMMAND TO RESTORE THE DATA
NXT MOVING ON TO DROP STATEMENT
DROP STATEMENT
● It is a Data Definition Language (DDL) command .
● It removes entire database I.e., datas,views ,indexes and the schema.
●No data recovery option is available
Backup data is required before execution of the command.
SYNTAX:-
DROP TABLE table_name;
For example
Using another table customers under ready database
To delete details of Sneha Acharjee from the table
DELETE FROM customers
WHERE CustomerName='Sneha Acharjee ';
Execute the query to see the result
To delete entire table
DELETE FROM customers ;
And to drop the table customers
DROP TABLE customers;
that's all for today Hope you all will get some help from this video
If it's so then don't forget to subscribe my channel Code with Neha and press the Bell Icon for Regular Updates
See you in the next video till then Stay Safe Stay Happy
#differencebetweendropanddeletecommand
#differencebetweendropanddeletecommandinsql
#differencebetweendropanddeletecommandinmysql
#droptableinmysql
#deletetableinmysql
#howtodroptableinmysql
#howtodeletetableinmysql
#deletetabledatainmysql
#droptablecommandinmysql
#droptablecommandinsql
#deletetableommandinmysql
#deletetablecommandinsql
#deletecommandinMySQL
#dropcommandinsql
#deletecommandinsql
#mysql
#mysqldb
#mysqltutorials
#mysqltutorialforbeginners
#mysqlupdatecommand
#sqlupdatecommand
#updatedatawithsql
#updatetabledatainmysql
#mysqldatabasetutorial
#updatingadatabase
#addingtablestoadatabase
#insertintostatement
#updatequeryinsql
#altertable
#altertablestatement
#altertablestatementinmysql
#altertablestatementinsql
#mysqlupdatequery
#whatisupdateinmysql
#sqlupdate
#mysqlupdatestatement
#mysqldatabase
#mysqlcourse
#mysqldatabasetutorial
#mysqlcrashcourse
#mysqltutorialforbeginners
#learnmysql
#learnsql
#SqlDMLcommands
#createinsertupdateinsql
#sqlupdatequery
#sqlcommands
#sqlqueries
#structuredquerylanguage
#sqlinterviewquestions
#sqlbasics
#sqlforbeginners