In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to use delete sentence to delete data, the article is very detailed, has a certain reference value, interested friends must read it!
How do I delete data using the delete statement?
Create a temporary table to demonstrate the use of delete deletion in sqlserver syntax
IF OBJECT_ID ('tempdb..#tblDelete') IS NOT NULL DROP TABLE # tblDelete; CREATE TABLE # tblDelete (Code varchar (50), Total int)
Insert several rows of tests into the temporary table # tblDelete to demonstrate how to delete data
Insert into # tblDelete (Code, Total) values ('Code1', 30); insert into # tblDelete (Code, Total) values (' Code2', 40); insert into # tblDelete (Code, Total) values ('Code3', 50); insert into # tblDelete (Code, Total) values (' Code4', 6)
Query test data in temporary table # tblDelete
Select * from # tblDelete
Delete the record of Code field = Code3 in temporary table # tblDelete, using the following delete statement
Delete # tblDelete where Code = 'Code3'
If you query the result of temporary table # tblDelete again, you can see that the record of Code3 is gone.
Select * from # tblDelete
Delete the record in the Code field = Code2 in the temporary table # tblDelete, using the following delete statement.
Note that the following delete statement is followed by a from keyword, which can be omitted, but is not recommended
Delete from # tblDelete where Code = 'Code2'
If you query the result of temporary table # tblDelete again, you can see that the record of Code2 is gone.
Select * from # tblDelete
Finally, if you want to delete all the data in the table quickly, there are two ways. The second way is faster.
Delete from # tblDelete;truncate table # tblDelete
The above is all the content of the article "how to delete data using delete statement". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.