Home  >  Article  >  Database  >  How to delete a row in sql

How to delete a row in sql

藏色散人
藏色散人Original
2021-04-13 15:43:1139205browse

In SQL, you can delete a certain row of data through the DELETE method, using syntax such as "delete from ms_cf01 where brxm='Zhang San' and id='7598';", where "ms_cf01" indicates the row to be deleted. The table to which the data belongs.

How to delete a row in sql

The operating environment of this article: Windows 7 system, Dell G3 computer, SQL Server 2016.

First of all, you need to determine which fields or field combinations can uniquely determine your row of data.

DELETE FROM table name WHERE field 1 = '' and field 2 = '' and... .Field 1,... is a field combination that can uniquely determine a certain row of data. Just fill in the specific value of the field you want to delete in ''

If there is a primary key, directly use the primary key to determine a certain row. That's it.

DELETE FROM table name WHERE primary key = ‘specific value’.

How to delete a row in sql

delete from ms_cf01 where brxm='张三' and id='7598';

where: ms_cf01 is what you want Delete the table to which that data belongs.

brxm, id is the condition under which you want to delete the data.

The effect of the above statement is to delete the row data in table ms_cf01 that matches brxm equals Zhang San and id equals 7598.

【Recommended learning: SQL video tutorial

The above is the detailed content of How to delete a row in sql. 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