Home>Article>Database> What is the difference between delete and drop

What is the difference between delete and drop

王林
王林 Original
2020-11-12 10:09:00 33661browse

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].

What is the difference between delete and drop

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn