1. Convert the data, sometimes it is necessary to convert the integer type to the floating point type.
1) Use the decimal point directly:
select 10*1.0 / 3
2) Use CAST for conversion (this is a little troublesome):
select cast(cast(10 as float)/3 as decimal(10,2)) as print
2. Query the results according to different conditions in the same SQL sentence:
1) Use CASE WHEN:
SELECT count(CASE WHEN cyqkbm ='2' THEN 1 ELSE NULL END) / count(*)