Common oracle sql summary (updated)

1, wm_concat: the multiple rows of data returned is a summary, by dividing the data type is the default type CLOB

       

 

 

2, recursive queries (tree structure data query, such as menus, department, etc.)

  SELECT

     [The LEVEL], *
  FEOM table_name
  the START condition the WITH. 1
  the CONNECT BY PRIOR is the condition 2
  the WHERE condition. 3
  the ORDER BY sort field

  1 --- The conditions defining the root node, of course, can be relaxed authority, to obtain a plurality of root nodes, i.e. multiple trees acquired
  condition 2 --- connection conditions, the purpose is what gives the relationship between the father and son, this relationship is recursive queries according to
  condition 3 --- filter conditions, to filter all records returned by the
  sort field --- sort all records returned

  

 

Guess you like

Origin www.cnblogs.com/linbky/p/11608876.html