{"id":75992,"date":"2024-05-04T22:50:43","date_gmt":"2024-05-05T02:50:43","guid":{"rendered":"http:\/\/bangla.sitestree.com\/oracle-advanced-sql-clauses-2\/"},"modified":"2024-05-04T22:50:43","modified_gmt":"2024-05-05T02:50:43","slug":"oracle-advanced-sql-clauses-2","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=75992","title":{"rendered":"Oracle Advanced SQL Clauses"},"content":{"rendered":"<p>Group By<\/p>\n<p>group by attr1, attr2<\/p>\n<p>group by ROLLUP(attr1, attr2)<\/p>\n<p>group by CUBE(attr1, attr2)<\/p>\n<p>Rank, Dense_RANK, ROW_number:<\/p>\n<p>RANK() OVER (ORDER BY PRICE) as &quot;PR&quot;,<br \/>\nROW_NUMBER() OVER (ORDER BY PRICE) as &quot;PR&quot;<br \/>\nDENSE_RANK() OVER (ORDER BY C DESC NULLS LAST) as &quot;R&quot;<br \/>\nDENSE_RANK() OVER (PARTITION by C ORDER BY P) as &quot;PR&quot;<br \/>\nRANK() OVER (ORDER BY P) as &quot;PR&quot;<br \/>\navg(C) OVER() AS &quot;AC&quot;<br \/>\nMIN(Y) KEEP (DENSE_RANK FIRST ORDER BY Y) as &quot;FirstItem&quot;<br \/>\nMIN(Y) KEEP (DENSE_RANK LAST ORDER BY Y) as &quot;LASTItem&quot;<\/p>\n<p>Hierarchical Query:<\/p>\n<p>START WITH employee_id = 102<br \/>\nCONNECT BY FOLLOWING m_id = e_id;<\/p>\n<p>Keep First or Last Row<\/p>\n<p>KEEP (DENSE_RANK FIRST ORDER BY \u2026)<br \/>\nKEEP (DENSE_RANK LAST ORDER BY \u2026)<\/p>\n<p>PARTITION BY on RANK\/Dense_Rank<\/p>\n<p>RANK()<br \/>\nRANK() OVER<br \/>\nRANK() OVER PARTITION BY<br \/>\nDENSE RANK() OVER<br \/>\nDENSE RANK() OVER PARTITION BY<br \/>\nPARTITION BY \u2026. ORDER BY<br \/>\nROW_NUMBER() OVER (ORDER By \u2026)<br \/>\nROWS BETWEEN Unbounded Preceding and CURRENT ROW<br \/>\nRANGE BETWEEN INTERVAL 5 DAY PRECEDING AND INTERVAL &#8216;5&#8217; DAY Following<br \/>\nROWS BETWENN 1 PRECEDING and 1 FOLLOWING<br \/>\nDENSE RANK() OVER (PARTITION BY &#8230;..)<br \/>\nDENSE RANK() OVER (PARTITION BY &#8230;..ORDER BY &#8230;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Group By group by attr1, attr2 group by ROLLUP(attr1, attr2) group by CUBE(attr1, attr2) Rank, Dense_RANK, ROW_number: RANK() OVER (ORDER BY PRICE) as &quot;PR&quot;, ROW_NUMBER() OVER (ORDER BY PRICE) as &quot;PR&quot; DENSE_RANK() OVER (ORDER BY C DESC NULLS LAST) as &quot;R&quot; DENSE_RANK() OVER (PARTITION by C ORDER BY P) as &quot;PR&quot; RANK() OVER (ORDER BY &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=75992\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[182],"tags":[],"class_list":["post-75992","post","type-post","status-publish","format-standard","hentry","category---blog","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":76666,"url":"http:\/\/bangla.sitestree.com\/?p=76666","url_meta":{"origin":75992,"position":0},"title":"Oracle: Hierarchical Queries and Advanced Analytics Functions","author":"Sayed","date":"March 26, 2025","format":false,"excerpt":"\u2022Hierarchical Queries \u2022START WITH \u2022CONNECT BY PRIOR \u2022CONNECT BY FOLLOWING \u2022ORDER by level \u2022Analytics Functions \u2022Windowing \u2022PRECEDING, UNBOUNDED_PRECEDING \u2022ROWS BETWEEN Unbounded Preceding \u2022CURRENT ROW \u2022RANGE BETWEEN INTERVAL 30 DAY PRECEDING AND INTERVAL \u201830\u2019 DAY Following \u2022ROWS BETWENN 1 PRECEDING and 1 FOLLOWING Other Analytics Functions and Clauses: \u2022OVER() \u2022PARTITION OVER\u2026","rel":"","context":"In &quot;Root&quot;","block_context":{"text":"Root","link":"http:\/\/bangla.sitestree.com\/?cat=1"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78165,"url":"http:\/\/bangla.sitestree.com\/?p=78165","url_meta":{"origin":75992,"position":1},"title":"Oracle PL\/SQL Concepts","author":"Sayed","date":"May 14, 2025","format":false,"excerpt":"Oracle PL\/SQL Concepts BLOCK declare .... Begin...End. Cursor Trigger Programming Clauses: if..then...else, case when, loops (for, while) Stored Procedure Function Advanced SQLs and Analytics Functions GROUP BY ROLLUP(), GROUP BY CUBE() RANK(), DENSE_RANK(), ROW_NUMBER() PARTITION_BY, ORDER BY X NULLS Last, ORDER BY X NULLS FIRST, RANGE BETWEEN INTERVAL 30 DAY\u2026","rel":"","context":"In &quot;Root&quot;","block_context":{"text":"Root","link":"http:\/\/bangla.sitestree.com\/?cat=1"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78671,"url":"http:\/\/bangla.sitestree.com\/?p=78671","url_meta":{"origin":75992,"position":2},"title":"compare contrast these commands: Get-Disk | Format-Table -Auto Get-PhysicalDisk Get-Partition -DiskNumber 0 Get-Partition -DriveLetter D","author":"Sayed","date":"May 24, 2026","format":false,"excerpt":"These four commands are all disk\/partition viewing commands, but they look at different levels of storage. The disk-management lab explains that Get-Disk shows logical disks, Get-PhysicalDisk shows physical disk devices, and Get-Partition is used to view partition information for a disk. CommandMain PurposeLevelGet-Disk | Format-Table -AutoShows disks in a clean\u2026","rel":"","context":"In &quot;Power Shell&quot;","block_context":{"text":"Power Shell","link":"http:\/\/bangla.sitestree.com\/?cat=1981"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":71316,"url":"http:\/\/bangla.sitestree.com\/?p=71316","url_meta":{"origin":75992,"position":3},"title":"What is the rank of a matrix?","author":"Sayed","date":"October 3, 2021","format":false,"excerpt":"If you can, answer the question below: Write your answer in the comment box. What is the rank of a matrix?","rel":"","context":"In &quot;Matrix and Signal Processing&quot;","block_context":{"text":"Matrix and Signal Processing","link":"http:\/\/bangla.sitestree.com\/?cat=1944"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78691,"url":"http:\/\/bangla.sitestree.com\/?p=78691","url_meta":{"origin":75992,"position":4},"title":"Q &amp; A:  Linux: Switch Users, Boot Process, File System","author":"Sayed","date":"June 1, 2026","format":false,"excerpt":"Quiz: Root Access, Boot Process, File Systems, Partitions, and Mounting 1. True\/False The root user is the superuser account and has the highest access rights on a Linux system. Answer: True 2. True\/False It is recommended to stay logged in as root for normal daily work because it is faster.\u2026","rel":"","context":"In &quot;Anything Linux&quot;","block_context":{"text":"Anything Linux","link":"http:\/\/bangla.sitestree.com\/?cat=1976"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":17008,"url":"http:\/\/bangla.sitestree.com\/?p=17008","url_meta":{"origin":75992,"position":5},"title":"Python: Ecommerce: Part \u2014 7: Partition a Data File (with product information) into Multiple Files.","author":"Sayed","date":"April 19, 2020","format":false,"excerpt":"In previous steps, we created a product data file to be uploaded to Magento 2 (from supplier data). However, there is a limit, how big a file can be uploaded to Magento 2 for product data import. Hence, this code will divide the data file into multiple files. This data\u2026","rel":"","context":"In &quot;Build Ecommerce Software&quot;","block_context":{"text":"Build Ecommerce Software","link":"http:\/\/bangla.sitestree.com\/?cat=1912"},"img":{"alt_text":"8112223 Canada Inc. (Justetc)","src":"https:\/\/miro.medium.com\/fit\/c\/80\/80\/0*P_esmjKoJnHlNjFX","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/75992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=75992"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/75992\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=75992"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=75992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}