Get the App
SLTechnology News&Howtos  ›  Database  › 

How to realize the operation of adding, deleting, changing and searching in sqlserver

Shulou Source: shulou.com Published: 2022-05-31 18:58:24 09月10日 Update

What this article shares with you is about how to add, delete, modify and check operations in sqlserver. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

One Insert statement

1. Insert only default values in the data:

Insert into [DBTrain] .[dbo] .[log _ info] default values

two。 In the field that can be null, if you want to set null, press [Ctrl+0], note that zero is not o, and press [Esc] if you want to restore the value before modification.

Two Update statements

You can update the data of the first few items or a certain percentage.

Update top (3) [log_info] set info1 = '1001'

Update top (80) percent [log_info] set info2 = '1002'

Three Delete statements can also use the top keyword

Four Select sentences

1. With Ties

Execute the following sql:select top 5 * from testorder by id desc

The results are shown in the following figure:

Then execute the following sql to see the difference:

Select top 5 with ties * from testorder by id desc

You can see that when the current five records have not yet fully displayed the data of id = 2

Using with ties, you can display all the records with id = 2.

To be continued。 $identity, $RowGuid,Write clause

The above is how to add, delete, modify and search operations in sqlserver. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Sentence data more knowledge article different practical following figure key keyword clause field that is work meeting article time percentage percentage look knowledge point Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Docker Linux NVidia vpn