Get the App
SLTechnology News&Howtos  ›  Database  › 

How to generate Chinese digits from given numbers by MySQL

Shulou Source: shulou.com Published: 2022-05-31 18:44:21 10月02日 Update

This article mainly explains "how to generate Chinese numbers with a given number by MySQL". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to achieve a given number to generate Chinese numbers" bar!

Using MySQL to realize

Select group_concat (target order by id desc Separator'') result from (

Select

Concat (

Case s

When 0 then if (@ lastrowrights zero,'')

When 1 then 'one'

When 2 then 'two'

When 3 then 'three'

When 4 then 'four'

When 5 then 'five'

When 6 then 'six'

When 7 then 'seven'

When 8 then 'eight'

When 9 then 'nine'

End

Case (id-1) mod 4 when 0 then''

When 1 then if (ten','')

When 2 then if ('hundred','')

When 3 then if ('thousand','')

End

Case ((id-1) / 4) when 1 then

When 2 then 'billion'

Else''

End

) target

@ lastrow:=s

A. *

From (

Select var.n,nums.id,substring (var.n,length (var.n)-id+1,1) s from (

Select 30150000 n writing lastroww is null.

) var, nums where length (var.n) > = nums.id

) a

) b

At this point, I believe you have a deeper understanding of "how to achieve a given number in MySQL to generate Chinese numbers". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Numbers Chinese generation content learning practical deeper interested practical practical easy to operate methods more friends websites channels inquiries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Huawei Apple Shulou Information Shulou Technology