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 mysql converts values to numeric types

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

Share

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

This article introduces the knowledge of "how mysql converts values to digital types". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Conversion methods: 1, with CAST (), syntax "SELECT CAST ('value' AS SIGNED);"; 2, with CONVERT (), syntax "SELECT CONVERT ('value', SIGNED);"; 3, with "+" operator, syntax "SELECT 'value' + 0;"

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

The method of converting values to numeric types by mysql

Method 1: use the CAST () function

The CAST () function converts a value (of any type) to a specified data type

Example:

SELECT CAST ('123' AS SIGNED)

Method 2: use the CONVERT () function

The CONVERT () function converts the value to the specified data type or character set.

Example:

SELECT CONVERT ('123 registered)

Method 3: use the "+" operator

Example:

This is the end of the introduction to "how mysql converts values to numeric types" in SELECT '123. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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