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 use where conditional query in mysql

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article is about how to use where conditional queries in mysql. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

-- where sentence

-- Delete users whose ID value is greater than 10

DELETE FROM register WHERE ID > 10

Delete users whose mobile number is not 18900000003

DELETE FROM register WHERE telemetry 18900000003umbent-weak syntax, this value can be used as a number or a string

-- AND OR: join multiple conditions

-- Delete id=5 or mobile number = 18900000005 user

DELETE FROM register where id=5 or tel=18900000005

-- delete id 10 and mobile number 189000011

DELETE FROM regist where id=10 AND tel=18900000011

DELETE FROM regist where id=10 AND tel=18900000010

-- modify all records

-- change the initial funds to 10000

UPDATE register SET fund=10000

-modify the record of the specified condition

UPDATE register SET fund=0 where id=1

-- AND OR

UPDATE register SET fund=0,tel=13777777777 where id=2

-- query all records and display all field values

Select * from register;-- * has some performance problems

-- query all records and display the specified field values

Select name,age,fund,tel from register

-- query users whose balance is greater than 2w, and display their name, balance information and mobile phone number

Select name,fund,tel from register where fund > 20000

-- Delete all records in the table

DELETE FROM register

-- clear the table to clear the self-growth value

Truncate table register

Thank you for reading! This is the end of this article on "how to use where condition query in mysql". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

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