mysql的那些熊事
//查询test_main_lirun表中a开头的字段名
SELECT COLUMN_NAME FROM information_schema.COLUMNS where table_name = 'test_main_lirun' and COLUMN_NAME like 'a%'
//用sum相加之后小数点后有很多位的问题,(5,1)是一共五位数,包括小数点后一位
select CAST(SUM(fraction) AS DECIMAL (5, 1)) as sum from ranking_student_curriculum
//两个时间相差多少分钟
SELECT * ,TIMESTAMPDIFF ( MINUTE, create_at,now() ) from order_form
//根据两地的坐标计算距离
select *, cast(st_distance_sphere(POINT(lon, lat), POINT(117.11297, 36.66167)) / 1000 as DECIMAL(5, 1)) as distance from building

浙公网安备 33010602011771号