SQL brush title notes

  • Record cattle guest online MySQL刷题笔记
  • 2020/3/16开始 Plan two weeks
  • Expected to 2020/4/1complete

Brush title notes a 1-22

Brush title notes two 23-

to sum up

  • 排序(无论是排序输出,求第几)
    • max, min (this limitation is relatively large, only maximum, minimum)
    • You can use limit x, x
    • Performed for a field in a sorting table, the table can be determined from the number of connections less than or greater than the table field of the record, and then using group bythe basis of the field of the packet, and then seek the last number of the packet count, the request may be rows in the order of a field
    select s1.emp_no,s1.salary
    from salaries s1
    inner join salaries s2/* 自连接*/
    on s1.salary < s2.salary
    where s1.to_date = '9999-01-01' and s2.to_date = '9999-01-01'
    group by s1.emp_no
    
He published 198 original articles · won praise 20 · views 20000 +

Guess you like

Origin blog.csdn.net/ZHOUJIAN_TANK/article/details/104895958