随笔分类 - MySQL
摘要:创建一张表,包括时间、学生学号、考勤状态 insert into px_data_test_temp.temp_stu_attendance_tb (date_col, stu_no, is_attendence) values ('2019-11-01','STU-00001','上课'), ('
阅读全文
摘要:SQL语句的执行顺序 1.from 2.where 3.group by...sum().. having... 4.select 5.order by 计算时间差值的函数 1)datediff(end_time,start_time) 计算两个date型之间的天数差 注意:结果是前-后,如果想得到
阅读全文
摘要:按从 Z 到 A 的顺序显示结果 字符串默认就是按字典顺序 Z 到 A 的排序:order by cust_name desc 先按XX排序,再按XX排序 先按顾客 ID 对结果进行排序,再按订单日期倒序排列。直接在order by中写多个字段即可。 select cust_id,order_num
阅读全文