Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write SQL query statement

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "SQL query sentence how to write", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to write SQL query sentence" this article.

Query all columns

Select * from Tblclass

Query the specified column

Select cid,cname from tblclass

Query specifies that only different items are displayed in the column

Select distinct pwd trom Tblclass

Query the specified row

Select * from tblclass where cid = 4

Query statements with empty / non-empty data content

Select * from tblclass where pwd is not null

Select * from tblclass where pwd is null

Query the specified data in a column

Select * from tblclass where pwd in ('123456')

Cid int identity (1 dint 2) primary key notnull

Note: identity (1, 2)

The first parameter is a starting value of 1

The second parameter is step 2

Note: primary key

Set as primary key, do not accept the same parameter, and need to be used when forcibly inserting this value

The insert statement cannot be written until Set identity_insert Tblclass on opens the statement.

Set identity_insert Tblclass off close statement

Modify identity parameters

Dbcc checkident ('tblclass',reseed,200)

Note: when adding more data, it will start from 200.

The above is all the contents of the article "how to write SQL query sentences". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report