Get the App
SLTechnology News&Howtos  ›  Database  › 

How to write SQL query statement

Shulou Source: shulou.com Published: 2022-05-31 14:46:29 10月03日 Update

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!

Tags: Queries sentences content parameters data articles learning help different same easy to understand more organization steps knowledge editing industry information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info NVidia Apple Linux Shulou Technology