Home >Database >Mysql Tutorial >What is the difference between delete and drop
The difference between delete and drop is: drop is mainly used to delete structures, and delete is mainly used to delete data. If we want to delete a database or data table, we will use drop to delete it, such as [drop database XX].
drop is mainly used to delete structures
(Learning video sharing: mysql video tutorial)
For example, to delete a database: drop database XX, to delete a table, drop table XX. Fields are also a type of structure. Can we also use drop? Yes, but if we change the table structure, we must first use the alter method. For example, if we want to delete the age field information on the student table, we can write like this: alter table student drop age
delete is mainly used to delete data
For example, if we want to delete the information on the student table All information with the name 'Zhang San': delete from student where name='Zhang San'. In this case, delete is used. It can be seen that delete is often used to delete data.
Related recommendations: mysql tutorial
The above is the detailed content of What is the difference between delete and drop. For more information, please follow other related articles on the PHP Chinese website!