http://fr.slideshare.net/MarkusWinand/modern-sql
SQL has gone out of fashion lately—partly due to the NoSQL movement, but mostly because SQL is often still used like 20 years ago. As a matter of fact, the SQL standard continued to evolve during the past decades resulting in the current release of 2011. In this session, we will go through the most important additions since the widely known SQL-92, explain how they work and how PostgreSQL supports and extends them. We will cover common table expressions and window functions in detail and have a very short look at the temporal features of SQL:2011 and the related features of PostgreSQL.
Phương pháp giải toán từ cơ bản đến nâng cao Hình Học 8-Tập 1- Nguyễn Quốc Tuấn Tuấn Nguyễn Quốc
Đặt mua sách qua Zalo: 0918972605
Mục lục
Chương I: Tứ giác
Trang 5:
Chủ đề 1: Tứ giác
Trang 23:
Chủ đề 2: Hình thang
Trang 35:
Chủ đề 3: Hình thang cân
Trang 55:
Chủ đề 4: Đường trung bình của tam giác- Hình thang
Trang 82:
Chủ đề 5: Dựng hình thang bằng thước kẻ và compa
Trang 90:
Chủ đề 6: Đối xứng trục
Trang 106:
Chủ đề 7: Hình bình hành
Trang 132:
Chủ đề 8: Đối xứng tâm
Trang 150:
Chủ đề 9: Hình chữ nhật
Trang 182:
Chủ đề 10: Hình thoi
Trang 196:
Chủ đề 11: Hình vuông
Trang 216:
Chủ đề 12: Bài tập ôn tập chương I
Chương II: ĐA GIÁC – DIỆN TÍCH CỦA ĐA GIÁC
Trang 230:
Chủ đề 1: Đa giác- đa giác đều
Trang 253:
Chủ đề 2: Diện tích hình chữ nhật
Trang 260:
Chủ đề 3: Diện tích tam giác- hình thang- hình bình hành- hình thoi
Trang 275:
Chủ đề 4: Diện tích đa giác
Trang 302:
Chủ đề 5: Một vài phương pháp tính diện tích khác
Trang 318:
Chủ đề 6: Bài tập ôn tập chương II
...
Phương pháp giải toán từ cơ bản đến nâng cao Đại Số 8-Tập 1- Nguyễn Quốc Tuấn Tuấn Nguyễn Quốc
Đặt mua sách qua Zalo: 0918972605
Có thể nói, sau nhiều lần nâng cấp tài liệu giảng dạy cho các em học sinh toán 8. Thì đây là phiên bản hoàn hảo nhất mà chúng tôi đã xây dựng được. Nó không những phù hợp và thực dụng đối với tất cả các em học sinh. Mà còn cực kỳ hữu ích cho quý thầy cô giáo dùng làm tài liệu giảng dạy cho học sinh của mình. Bạn đọc sẽ cảm nhận được những điều mà chúng tôi đã trình bày trong tài liệu.
Tính thực dụng ở đây thể hiện rõ ở chổ những bài học, những chủ đề và những dạng toán đều được chúng tôi biên soạn và sưu tập theo đúng mỗi dạng toán. Trong mỗi dạng toán chúng tôi đã lọc từ hàng trăm, thậm chí hàng ngàn đề thi mới nhất hằng năm. Những bài toán thường gặp đó, đều được đưa vào những dạng toán tương ứng. Trong bản thân mỗi dạng toán, tác giả đã chia thành các mục tương ứng. Bao gồm: Phương pháp giải toán- Bài tập mẫu- Bài tập luyện tập và hướng dẫn giải đi kèm. Qua đó giúp cho bạn đọc có thể học tập và thực hành ngay những kiến thức chúng tôi giới thiệu trong sách.
Trong quyển “Phương pháp giải toán từ cơ bản đến nâng cao- Đại số 8- Tập 1” này. Bạn đọc sẽ gặp nội dung đại số có trong học kì 1. Chính yếu bao gồm hai chương. Chương I: Phép nhân và chia đa thức, Chương II: Phân thức đại số. Mỗi phần sẽ có những dạng toán mà chúng tôi đã lọc ra từ những nguồn tài liệu chất lượng. Các phương pháp và giải chi tiết chúng tôi cũng đã trình bày một cách rõ ràng mạch lạc. Qua đó bạn đọc hoàn toàn tham khảo để lĩnh hội kiến thức.
Đúng như mục đích mà chúng tôi viết tài liệu này. Từ cơ bản đến nâng cao, nên ngoại trừ những phương pháp mà tác giả đã nêu. Các bài toán lần lượt được giới thiệu trong mỗi dạng toán đều được viết theo dạng nâng cao lần lượt. Điều này phù hợp với tất cả các em học sinh đều có thể dùng được. Hoặc quý thầy cô giáo vẫn dùng cho việc dạy và cho học sinh luyện tập.
...
Phương pháp giải toán từ cơ bản đến nâng cao Hình Học 8-Tập 1- Nguyễn Quốc Tuấn Tuấn Nguyễn Quốc
Đặt mua sách qua Zalo: 0918972605
Mục lục
Chương I: Tứ giác
Trang 5:
Chủ đề 1: Tứ giác
Trang 23:
Chủ đề 2: Hình thang
Trang 35:
Chủ đề 3: Hình thang cân
Trang 55:
Chủ đề 4: Đường trung bình của tam giác- Hình thang
Trang 82:
Chủ đề 5: Dựng hình thang bằng thước kẻ và compa
Trang 90:
Chủ đề 6: Đối xứng trục
Trang 106:
Chủ đề 7: Hình bình hành
Trang 132:
Chủ đề 8: Đối xứng tâm
Trang 150:
Chủ đề 9: Hình chữ nhật
Trang 182:
Chủ đề 10: Hình thoi
Trang 196:
Chủ đề 11: Hình vuông
Trang 216:
Chủ đề 12: Bài tập ôn tập chương I
Chương II: ĐA GIÁC – DIỆN TÍCH CỦA ĐA GIÁC
Trang 230:
Chủ đề 1: Đa giác- đa giác đều
Trang 253:
Chủ đề 2: Diện tích hình chữ nhật
Trang 260:
Chủ đề 3: Diện tích tam giác- hình thang- hình bình hành- hình thoi
Trang 275:
Chủ đề 4: Diện tích đa giác
Trang 302:
Chủ đề 5: Một vài phương pháp tính diện tích khác
Trang 318:
Chủ đề 6: Bài tập ôn tập chương II
...
Phương pháp giải toán từ cơ bản đến nâng cao Đại Số 8-Tập 1- Nguyễn Quốc Tuấn Tuấn Nguyễn Quốc
Đặt mua sách qua Zalo: 0918972605
Có thể nói, sau nhiều lần nâng cấp tài liệu giảng dạy cho các em học sinh toán 8. Thì đây là phiên bản hoàn hảo nhất mà chúng tôi đã xây dựng được. Nó không những phù hợp và thực dụng đối với tất cả các em học sinh. Mà còn cực kỳ hữu ích cho quý thầy cô giáo dùng làm tài liệu giảng dạy cho học sinh của mình. Bạn đọc sẽ cảm nhận được những điều mà chúng tôi đã trình bày trong tài liệu.
Tính thực dụng ở đây thể hiện rõ ở chổ những bài học, những chủ đề và những dạng toán đều được chúng tôi biên soạn và sưu tập theo đúng mỗi dạng toán. Trong mỗi dạng toán chúng tôi đã lọc từ hàng trăm, thậm chí hàng ngàn đề thi mới nhất hằng năm. Những bài toán thường gặp đó, đều được đưa vào những dạng toán tương ứng. Trong bản thân mỗi dạng toán, tác giả đã chia thành các mục tương ứng. Bao gồm: Phương pháp giải toán- Bài tập mẫu- Bài tập luyện tập và hướng dẫn giải đi kèm. Qua đó giúp cho bạn đọc có thể học tập và thực hành ngay những kiến thức chúng tôi giới thiệu trong sách.
Trong quyển “Phương pháp giải toán từ cơ bản đến nâng cao- Đại số 8- Tập 1” này. Bạn đọc sẽ gặp nội dung đại số có trong học kì 1. Chính yếu bao gồm hai chương. Chương I: Phép nhân và chia đa thức, Chương II: Phân thức đại số. Mỗi phần sẽ có những dạng toán mà chúng tôi đã lọc ra từ những nguồn tài liệu chất lượng. Các phương pháp và giải chi tiết chúng tôi cũng đã trình bày một cách rõ ràng mạch lạc. Qua đó bạn đọc hoàn toàn tham khảo để lĩnh hội kiến thức.
Đúng như mục đích mà chúng tôi viết tài liệu này. Từ cơ bản đến nâng cao, nên ngoại trừ những phương pháp mà tác giả đã nêu. Các bài toán lần lượt được giới thiệu trong mỗi dạng toán đều được viết theo dạng nâng cao lần lượt. Điều này phù hợp với tất cả các em học sinh đều có thể dùng được. Hoặc quý thầy cô giáo vẫn dùng cho việc dạy và cho học sinh luyện tập.
...
OSGI workshop - Become A Certified Bundle ManagerSkills Matter
OSGi is great at enabling you to build your systems out of sets of bundles. In a way, your bundles are your configuration. However, this also requires you to master the identification, assembly and provisioning of all of the components that make-up your system.
* How do you hot-deploy bundles for delivery?
* Is there a simple way of bootstrapping your system with specific configurations that are easy to assemble and kick-start?
* Once your system is "out there" how can you take things one-step further and manage the provisioning remotely?
* Is there an easy way to let the user discover and deploy what he wants, when he wants it?
* How can you do all of these things using existing technologies?
Well, you've come to the right place. In this workshop we will focus on ways to manage OSGi installations. Using a simple example application, we will show you how you can:
* use Fileinstall to hot-deploy bundles into your live application environment
* take advantage of Pax Runner to create and easily bootstrap configurations of bundles
* remotely manage, provision, and audit systems in the field with Apache Ace
* provide, discover, and deploy bundles using Apache Felix OBR
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Amazon Web Services
AWS Elastic Beanstalk provides an easy way for you to quickly deploy and manage applications in the AWS cloud. In this Zero to Sixty session, accelerate your use of Elastic Beanstalk by learning how Nike and VTEX use several of its most powerful features. Through interactive demos and code samples for both Windows and Linux, this session teaches you how to achieve deployments with zero downtime, how to easily enable or disable application functionality via feature flags, and how to customize your Elastic Beanstalk environments with extensions. Demos and code samples are available to all session attendees.
Are you new to Elastic Beanstalk? Get up to speed for this session by first completing the 60-minute Fundamentals of Elastic Beanstalk lab in the Self Paced Lab Lounge.
OSGI workshop - Become A Certified Bundle ManagerSkills Matter
OSGi is great at enabling you to build your systems out of sets of bundles. In a way, your bundles are your configuration. However, this also requires you to master the identification, assembly and provisioning of all of the components that make-up your system.
* How do you hot-deploy bundles for delivery?
* Is there a simple way of bootstrapping your system with specific configurations that are easy to assemble and kick-start?
* Once your system is "out there" how can you take things one-step further and manage the provisioning remotely?
* Is there an easy way to let the user discover and deploy what he wants, when he wants it?
* How can you do all of these things using existing technologies?
Well, you've come to the right place. In this workshop we will focus on ways to manage OSGi installations. Using a simple example application, we will show you how you can:
* use Fileinstall to hot-deploy bundles into your live application environment
* take advantage of Pax Runner to create and easily bootstrap configurations of bundles
* remotely manage, provision, and audit systems in the field with Apache Ace
* provide, discover, and deploy bundles using Apache Felix OBR
Zero to Sixty: AWS Elastic Beanstalk (DMG204) | AWS re:Invent 2013Amazon Web Services
AWS Elastic Beanstalk provides an easy way for you to quickly deploy and manage applications in the AWS cloud. In this Zero to Sixty session, accelerate your use of Elastic Beanstalk by learning how Nike and VTEX use several of its most powerful features. Through interactive demos and code samples for both Windows and Linux, this session teaches you how to achieve deployments with zero downtime, how to easily enable or disable application functionality via feature flags, and how to customize your Elastic Beanstalk environments with extensions. Demos and code samples are available to all session attendees.
Are you new to Elastic Beanstalk? Get up to speed for this session by first completing the 60-minute Fundamentals of Elastic Beanstalk lab in the Self Paced Lab Lounge.
Understanding User Behavior with Google Analytics.pdfSEO Article Boost
Unlocking the full potential of Google Analytics is crucial for understanding and optimizing your website’s performance. This guide dives deep into the essential aspects of Google Analytics, from analyzing traffic sources to understanding user demographics and tracking user engagement.
Traffic Sources Analysis:
Discover where your website traffic originates. By examining the Acquisition section, you can identify whether visitors come from organic search, paid campaigns, direct visits, social media, or referral links. This knowledge helps in refining marketing strategies and optimizing resource allocation.
User Demographics Insights:
Gain a comprehensive view of your audience by exploring demographic data in the Audience section. Understand age, gender, and interests to tailor your marketing strategies effectively. Leverage this information to create personalized content and improve user engagement and conversion rates.
Tracking User Engagement:
Learn how to measure user interaction with your site through key metrics like bounce rate, average session duration, and pages per session. Enhance user experience by analyzing engagement metrics and implementing strategies to keep visitors engaged.
Conversion Rate Optimization:
Understand the importance of conversion rates and how to track them using Google Analytics. Set up Goals, analyze conversion funnels, segment your audience, and employ A/B testing to optimize your website for higher conversions. Utilize ecommerce tracking and multi-channel funnels for a detailed view of your sales performance and marketing channel contributions.
Custom Reports and Dashboards:
Create custom reports and dashboards to visualize and interpret data relevant to your business goals. Use advanced filters, segments, and visualization options to gain deeper insights. Incorporate custom dimensions and metrics for tailored data analysis. Integrate external data sources to enrich your analytics and make well-informed decisions.
This guide is designed to help you harness the power of Google Analytics for making data-driven decisions that enhance website performance and achieve your digital marketing objectives. Whether you are looking to improve SEO, refine your social media strategy, or boost conversion rates, understanding and utilizing Google Analytics is essential for your success.
Italy Agriculture Equipment Market Outlook to 2027harveenkaur52
Agriculture and Animal Care
Ken Research has an expertise in Agriculture and Animal Care sector and offer vast collection of information related to all major aspects such as Agriculture equipment, Crop Protection, Seed, Agriculture Chemical, Fertilizers, Protected Cultivators, Palm Oil, Hybrid Seed, Animal Feed additives and many more.
Our continuous study and findings in agriculture sector provide better insights to companies dealing with related product and services, government and agriculture associations, researchers and students to well understand the present and expected scenario.
Our Animal care category provides solutions on Animal Healthcare and related products and services, including, animal feed additives, vaccination
Gen Z and the marketplaces - let's translate their needsLaura Szabó
The product workshop focused on exploring the requirements of Generation Z in relation to marketplace dynamics. We delved into their specific needs, examined the specifics in their shopping preferences, and analyzed their preferred methods for accessing information and making purchases within a marketplace. Through the study of real-life cases , we tried to gain valuable insights into enhancing the marketplace experience for Generation Z.
The workshop was held on the DMA Conference in Vienna June 2024.
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBrad Spiegel Macon GA
Brad Spiegel Macon GA’s journey exemplifies the profound impact that one individual can have on their community. Through his unwavering dedication to digital inclusion, he’s not only bridging the gap in Macon but also setting an example for others to follow.
Ready to Unlock the Power of Blockchain!Toptal Tech
Imagine a world where data flows freely, yet remains secure. A world where trust is built into the fabric of every transaction. This is the promise of blockchain, a revolutionary technology poised to reshape our digital landscape.
Toptal Tech is at the forefront of this innovation, connecting you with the brightest minds in blockchain development. Together, we can unlock the potential of this transformative technology, building a future of transparency, security, and endless possibilities.
4. Inline views can't refer to outside the view:
!"#"$%&'
&&()*+&,-
&&.*/0&1!"#"$%&'
&&&&&&&&&&()*+&,2
&&&&&&&&&34")"&,256&7&,-56
&&&&&&&8&9:;9:<=>9<?
&&&&*0&19:;9:<=>9<?56&7&,-568
LATERAL Before SQL:1999
Invalid
5. Inline views can't refer to outside the view:
!"#"$%&'
&&()*+&,-
&&.*/0&1!"#"$%&'
&&&&&&&&&&()*+&,2
&&&&&&&&&34")"&,256&7&,-56
&&&&&&&8&9:;9:<=>9<?
&&&&*0&19:;9:<=>9<?56&7&,-568
LATERAL Before SQL:1999
Belongs
there
6. SQL:99 #@%")@# views can:
!"#"$%&'
&&()*+&,-
&&.*/0&!"#$%"!&1!"#"$%&'
&&&&&&&&&&&&&&&&&&()*+&,2
&&&&&&&&&&&&&&&&&34")"&,256&7&,-56
&&&&&&&&&&&&&&&8&9:;9:<=>9<?
&&&&*0&1,AB<8
LATERAL Since SQL:1999
Valid due to
LATERAL
keyword
Useless, but
still required
except
for CROSS join
8. Apply #/+/% per row from previous table:
!"#"$%&,CD=DACEBF,G5'
&&()*+&FH,<ICA9<G&F
&&.*/0&#@%")@#&1!"#"$%&'
&&&&&&&&&&&&&&&&&&()*+&DACEBF,G&D
&&&&&&&&&&&&&&&&&34")"&D5FH,&7&F5FH,
&&&&&&&&&&&&&&&&&'%($%&)*&+,-./0&($12
&&&&&&&&&&&&&&&&&!343#&5
&&&&&&&&&&&&&&&8&,CD=DACEBF,G
LATERAL and Top-N per Group
9. Get the 10 most recent news for subscribed topics:
!"#"$%&:5'
&&()*+&:<?G&:
&&.*/0&GBJGFA9D,9C:G&G
&&&&*0&1:5,CD9F&7&G5,CD9F8
&34")"&G5BG<A&7&K
&*)L")&MN&:5FA<H,<E&L"!$
&#/+/%&-O
LATERAL and Multi-Source Top-N
15. LATERAL in an Nutshell
#@%")@# is the "for each" loop of SQL
#@%")@# plays well with outer joins
#@%")@# is an optimization Super-Power
#@%")@# handy to join table functions
18. WITH Before SQL:99
Nested queries are hard to read:
!"#"$%&a
&&()*+&1!"#"$%&a
&&&&&&&&&&()*+&,-
&&&&&&&&&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&&&&&&&&&8&H&*0&1a8
&&&&&&&8&J
&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&8&F&*0&1a8
19. Understand
this first
WITH Before SQL:99
Nested queries are hard to read:
!"#"$%&a
&&()*+&1!"#"$%&a
&&&&&&&&&&()*+&,-
&&&&&&&&&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&&&&&&&&&8&H&*0&1a8
&&&&&&&8&J
&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&8&F&*0&1a8
20. WITH Before SQL:99
Then this...
Nested queries are hard to read:
!"#"$%&a
&&()*+&1!"#"$%&a
&&&&&&&&&&()*+&,-
&&&&&&&&&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&&&&&&&&&8&H&*0&1a8
&&&&&&&8&J
&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&8&F&*0&1a8
21. WITH Before SQL:99
Then this...
Nested queries are hard to read:
!"#"$%&a
&&()*+&1!"#"$%&a
&&&&&&&&&&()*+&,-
&&&&&&&&&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&&&&&&&&&8&H&*0&1a8
&&&&&&&8&J
&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&8&F&*0&1a8
22. WITH Before SQL:99
Finally the first line makes sense
Nested queries are hard to read:
!"#"$%&a
&&()*+&1!"#"$%&a
&&&&&&&&&&()*+&,-
&&&&&&&&&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&&&&&&&&&8&H&*0&1a8
&&&&&&&8&J
&&.*/0&1!"#"$%&a&()*+&a
&&&&&&&8&F&*0&1a8
23. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
WITH Since SQL:99
24. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
Keyword
WITH Since SQL:99
25. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
WITH Since SQL:99
Name of CTE and (here
optional) column names
26. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
WITH Since SQL:99
Definition
27. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
WITH Since SQL:99
Introduces
another CTE
Don't repeat
WITH
28. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
WITH Since SQL:99
29. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
WITH Since SQL:99
May refer to
previous CTEs
33. CTEs are statement-scoped views:
3/%4
&H&1F-b&F2b&FQ8
@!&1!"#"$%&F-b&F2b&FQ&()*+&a8b
&J&1F]b&a8
@!&1!"#"$%&F]b&a
&&&&&&()*+&,-
&&&&&&.*/0&H
&&&&&&&&*0&1a8
&&&8b
&F&1a8
@!&1!"#"$%&a&()*+&a8
!"#"$%&a
&&()*+&J&.*/0&F&*0&1a8
WITH Since SQL:99
Read
top down
34. WITH in an Nutshell
3/%4 are the "private methods" of SQL
3/%4 views can be referred to multiple times
3/%4 allows chaining instead of nesting
3/%4 is allowed where !"#"$% is allowed
/0!")%&/0%*&,J;
3/%4&555&!"#"$%&555
43. (This page is intentionally left blank)
WITH RECURSIVE Before SQL:99
44. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
Keyword
45. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
Column list
mandatory here
46. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
Executed first
47. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
Result
sent there
48. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
Result
visible
twice
49. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
&:&
TTT
&-
&2
&Q
1Q&AC?G8
Once it becomes
part of
the final
result
50. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
&:&
TTT
&-
&2
&Q
1Q&AC?G8
Second
leg of
UNION
is
executed
51. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
&:&
TTT
&-
&2
&Q
1Q&AC?G8
Result
sent there
again
52. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
&:&
TTT
&-
&2
&Q
1Q&AC?G8
53. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
&:&
TTT
&-
&2
&Q
1Q&AC?G8
It's a
loop!
54. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
&:&
TTT
&-
&2
&Q
1Q&AC?G8
n=3
doesn't
match
55. Recursive common table expressions may refer to
themselves in the second leg of a d0/*0&f@##g:
3/%4&)"$d)!/h"&F,<&1:8
&&@!&1!"#"$%&-
&&&&&&&d0/*0&@##
&&&&&&!"#"$%&:i-
&&&&&&&&()*+&F,<
&&&&&&&34")"&:&j&Q8
!"#"$%&'&()*+&F,<c
WITH RECURSIVE Since SQL:99
&:&
TTT
&-
&2
&Q
1Q&AC?G8
n=3
doesn't
match
Loop
terminates
56. WITH RECURSIVE Use Cases
• Row generators (previous example)
(I<:<AH,<=G<A9<G18 is proprietary)
• Processing graphs
(don't forget the cycle detection!)
• Generally said: Loops that...
‣ ... pass data to the next iteration
‣ ... need a "dynamic" abort condition
57. WITH RECURSIVE in a Nutshell
3/%4&)"$d)!/h" is the ?V9;< of SQL
3/%4&)"$d)!/h" "supports" infinite loops
(not in SQL Server where +@k)"$d)!/*0 is limited to 32767)
Except PostgreSQL, databases generally
don't require the )"$d)!/h" keyword
61. Pivot table: Years on the Y asis, Month on X axis:
!"#"$%&'"()*&
!"#$%&!'()*'+(#,+-*(.(/
(((((((((-*'+(01230('4!'(5('+67(8&+*
!+,-$(!"&./"0&,10%/&2&3
&&&&&&&&&%/"0&45674&"#!"&8&"09:&;"<*=
&&;)1,&4567>?5@5
&A)1+B&<'&'"()
FILTER Before SQL:2003
65. Show percentage of department salary:
3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:,
&&@!&1!"#"$%&E<Db&!d+1GH;HA`8&,C,H;
&&&&&&&&()*+&<PD
&&&&&&&e)*d_&MN&E<D8
!"#"$%&E<Db&<PD=9Eb&GH;HA`b
&&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm
&&()*+&<PD
&&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G
&&&&*0&1<PD5E<D&7&,G5E<D8
&34")"&<PD5E<D&7&K
OVER Before SQL:2003
66. Show percentage of department salary:
3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:,
&&@!&1!"#"$%&E<Db&!d+1GH;HA`8&,C,H;
&&&&&&&&()*+&<PD
&&&&&&&e)*d_&MN&E<D8
!"#"$%&E<Db&<PD=9Eb&GH;HA`b
&&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm
&&()*+&<PD
&&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G
&&&&*0&1<PD5E<D&7&,G5E<D8
&34")"&<PD5E<D&7&K
OVER Before SQL:2003
67. Show percentage of department salary:
3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:,
&&@!&1!"#"$%&E<Db&!d+1GH;HA`8&,C,H;
&&&&&&&&()*+&<PD
&&&&&&&e)*d_&MN&E<D8
!"#"$%&E<Db&<PD=9Eb&GH;HA`b
&&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm
&&()*+&<PD
&&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G
&&&&*0&1<PD5E<D&7&,G5E<D8
&34")"&<PD5E<D&7&K
OVER Before SQL:2003
68. Show percentage of department salary:
3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:,
&&@!&1!"#"$%&E<Db&!d+1GH;HA`8&,C,H;
&&&&&&&&()*+&<PD
&&&&&&&e)*d_&MN&E<D8
!"#"$%&E<Db&<PD=9Eb&GH;HA`b
&&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm
&&()*+&<PD
&&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G
&&&&*0&1<PD5E<D&7&,G5E<D8
&34")"&<PD5E<D&7&K
OVER Before SQL:2003
WITH intermezzo
69. Show percentage of department salary:
3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:,
&&@!&1!"#"$%&E<Db&!d+1GH;HA`8&,C,H;
&&&&&&&&()*+&<PD
&&&&&&&e)*d_&MN&E<D8
!"#"$%&E<Db&<PD=9Eb&GH;HA`b
&&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm
&&()*+&<PD
&&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G
&&&&*0&1<PD5E<D&7&,G5E<D8
&34")"&<PD5E<D&7&K
OVER Before SQL:2003
71. Build aggregates without e)*d_&MN:
!"#"$%&E<Db&<PD=9Eb&GH;HA`b
&&&&&&&GH;HA`l1A4B>.C.-DE
&&&&&&&&&&&&&&'F$%BG"%#3#3'H&)*&97+E
&&&&&&&&&&&&&'&-OO&mn&Co&E<Dm
&&()*+&<PD
OVER Since SQL:2003
72. OVER How It Works
E<D GH;HA`
- -OOO ROOO
22 -OOO ROOO
22 -OOO ROOO
QQQ -OOO ROOO
QQQ -OOO ROOO
QQQ -OOO ROOO
!"#"$%&E<Db&
&&&&&&&GH;HA`b
&&&&&&&!d+1GH;HA`8
&&&&&&&*h")&18
&&()*+&<PDc
73. OVER How It Works
E<D GH;HA`
- -OOO ROOO
22 -OOO ROOO
22 -OOO ROOO
QQQ -OOO ROOO
QQQ -OOO ROOO
QQQ -OOO ROOO
!"#"$%&E<Db&
&&&&&&&GH;HA`b
&&&&&&&!d+1GH;HA`8
&&&&&&&*h")&18
&&()*+&<PDc
74. OVER How It Works
E<D GH;HA`
- -OOO ROOO
22 -OOO ROOO
22 -OOO ROOO
QQQ -OOO ROOO
QQQ -OOO ROOO
QQQ -OOO ROOO
!"#"$%&E<Db&
&&&&&&&GH;HA`b
&&&&&&&!d+1GH;HA`8
&&&&&&&*h")&18
&&()*+&<PDc
78. OVER in a Nutshell
*h") may follow any aggregate function
*h") defines which rows are visible at each row
(it does not limit the result in any way)
*h")18 makes all rows visible at every row
*h")1_@)%/%/*0&MN x) segregates like e)*d_&MN
80. OVER Before SQL:2003
Calculating a running total:
!"#"$%&,69Eb&>H;B<b
&&&&&&&1!"#"$%&!d+1>H;B<8
&&&&&&&&&&()*+&,AH:GHF,9C:G&,62
&&&&&&&&&34")"&HF:,&7&K
&&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH;
&&()*+&,AH:GHF,9C:G&,6-
&34")"&HF:,&7&K
&*)L")&MN&,69E
81. OVER Before SQL:2003
Calculating a running total:
!"#"$%&,69Eb&>H;B<b
&&&&&&&1!"#"$%&!d+1>H;B<8
&&&&&&&&&&()*+&,AH:GHF,9C:G&,62
&&&&&&&&&34")"&HF:,&7&K
&&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH;
&&()*+&,AH:GHF,9C:G&,6-
&34")"&HF:,&7&K
&*)L")&MN&,69E
82. OVER Before SQL:2003
Calculating a running total:
!"#"$%&,69Eb&>H;B<b
&&&&&&&1!"#"$%&!d+1>H;B<8
&&&&&&&&&&()*+&,AH:GHF,9C:G&,62
&&&&&&&&&34")"&HF:,&7&K
&&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH;
&&()*+&,AH:GHF,9C:G&,6-
&34")"&HF:,&7&K
&*)L")&MN&,69E
83. OVER Before SQL:2003
Calculating a running total:
!"#"$%&,69Eb&>H;B<b
&&&&&&&1!"#"$%&!d+1>H;B<8
&&&&&&&&&&()*+&,AH:GHF,9C:G&,62
&&&&&&&&&34")"&HF:,&7&K
&&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH;
&&()*+&,AH:GHF,9C:G&,6-
&34")"&HF:,&7&K
&*)L")&MN&,69E
84. OVER Before SQL:2003
Calculating a running total:
!"#"$%&,69Eb&>H;B<b
&&&&&&&1!"#"$%&!d+1>H;B<8
&&&&&&&&&&()*+&,AH:GHF,9C:G&,62
&&&&&&&&&34")"&HF:,&7&K
&&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH;
&&()*+&,AH:GHF,9C:G&,6-
&34")"&HF:,&7&K
&*)L")&MN&,69E
85. OVER Before SQL:2003
Before SQL:2003 running totals were awkward:
‣ Requires a scalar sub-select or self-join
‣ Poor maintainability (reparative clauses)
‣ Poor performance
The only real answer was:
Do it in the application
86. With SQL:2003 you can narrow the window:
!"#"$%&,69Eb&>H;B<b
&&&&&&&!d+1>H;B<8
&&&&&&&*h")1'%($%&)*&8IJ9
&&&&&&&&&&&&%'K1
&&&&&&&&&&&&)$#K$$H&AH)'AH($(&G%$2$(3HL
&&&&&&&&&&&&&&&&"H(&2A%%$H#&%'K8&JH;
&&()*+&,AH:GHF,9C:G&,6-
&34")"&HF:,&7&K
&*)L")&MN&,69E
OVER Since SQL:2003
87. With *h")&1*)L")&MN&a8 a new type of
functions makes sense:
‣ )*3=0d+M")
‣ Ranking functions:&
)@0pb&L"0!"=)@0pb&_")$"0%=)@0pb
$d+"=L/!%
OVER Since SQL:2003
90. WITHIN GROUP Before SQL:2003
Getting the median:
!"#"$%&'()*+,
&&-./0&'+1+&'(
&&2/34&'+1+&'5
&&&&/4&6'()*+,&7&'5)*+,
&&&&&&&/.&6'()*+,8'5)*+,&94:&'();'7'5);'<<
&=./>?&@A&'()*+,
B9C34=&DEFG16H<&8&
&&&&&&&6!"#"$%&-#//.6$/>4%6H<I5<
&&&&&&&&&&-./0&'+1+<
91. WITHIN GROUP Since SQL:2003
SQL:2003 introduced ordered-set functions...
!"#"$%&'"($")%*#"+,*!$-./01
&&&&&&&2*%3*)&4(56'&-5(,"(&78&9:;1
&&<(5=&>:?:
...and hypothetical-set functions to say which rank
a hypothetical row would have:
&!"#"$%&(@)A-BCD1
&&&&&&&&2*%3*)&4(56'&-5(,"(&78&9:;1
&&&<(5=&>:?:
Median
Which value?
95. Calculate the difference to a previous row:
3/%4&:BPJ<A<E=EH,H&@!&1
&!"#"$%&'b
&&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A:
&&&()*+&EH,H8&
!"#"$%&FBA5'b&FBA5JH;H:F<TDA<>5JH;H:F<
&&()*+&&&&&&:BPJ<A<E=EH,H&FBA
&&#"(%&.*/0&:BPJ<A<E=EH,H&DA<>
&&&&*0&1FBA5A:&7&DA<>5A:T-8
OVER Before SQL:2008
96. Calculate the difference to a previous row:
3/%4&:BPJ<A<E=EH,H&@!&1
&!"#"$%&'b
&&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A:
&&&()*+&EH,H8&
!"#"$%&FBA5'b&FBA5JH;H:F<TDA<>5JH;H:F<
&&()*+&&&&&&:BPJ<A<E=EH,H&FBA
&&#"(%&.*/0&:BPJ<A<E=EH,H&DA<>
&&&&*0&1FBA5A:&7&DA<>5A:T-8
OVER Before SQL:2008
97. SQL:2008 can access other rows directly:
!"#"$%&'b&JH;H:F<&T&#@e1JH;H:F<8
&&&&&&&&&&&&&&&&&&&&*h")1*)L")&MN&68
&&()*+&EH,H
Available functions:
&#"@L&l&#@e
&(/)!%=h@#d"&l&#@!%=h@#d"
&0%4=h@#d"1FC;b&:8&()*+&(/)!%l#@!%
&&&&&&&&&&&&&&&&&&&)"!_"$%l/e0*)"&0d##!
OVER Since SQL:2008
Not supported
by PostgreSQL
(as of 9.4)
100. Limit the number of selected rows:
!"#"$%&'
&&()*+&1!"#"$%&'b
&&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A:
&&&()*+&EH,H8&:BPJ<A<E=EH,H
&34")"&A:&j7-O
FETCH FIRST Before SQL:2008
101. Limit the number of selected rows:
!"#"$%&'
&&()*+&1!"#"$%&'b
&&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A:
&&&()*+&EH,H8&:BPJ<A<E=EH,H
&34")"&A:&j7-O
FETCH FIRST Before SQL:2008
PostgreSQL
does not optimize
this properly!
102. Limit the number of selected rows:
!"#"$%&'
&&()*+&1!"#"$%&'b
&&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A:
&&&()*+&EH,H8&:BPJ<A<E=EH,H
&34")"&A:&j7-O
FETCH FIRST Before SQL:2008
Dammit!
Let's take
LIMIT
(or TOP)
107. Skip 10 rows, then deliver only the next 10:
!"#"$%&'
&&()*+&1!"#"$%&'b
&&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A:
&&&()*+&EH,H
&&("%$4&(/)!%&2O&)*3!&*0#N
8&:BPJ<A<E=EH,H
&34")"&A:&U&-O
OFFSET Before SQL:2011
112. Prior SQL:2011 it was not possible to define
constraints that avoid overlapping periods.
Workarounds are possible,
but no fun: $)"@%"&%)/ee")
WITHOUT OVERLAPS Before SQL:2011
id begin end
1 8:00 9:00
1 9:00 11:00
1 10:00 12:00
113. SQL:2011 introduced temporal and bi-temporal
features —e.g., for constraints:
_)/+@)N&p"N&19Eb&+7-J<9&K3#N'A#&'F$%!"G18
PostgreSQL 9.2 introduced range types and
"exclusive constraints" which can accomplish the
same effect:
"k$#dL"&d!/0e&I9G,
&&&&&&&&19E&3/%4&7b&+7-J<9&K3#N&OO8
WITHOUT OVERLAPS Since SQL:2011
114. SQL:2011 goes far beyond 3/%4*d%&*h")#@_!.
Please read these papers to get the idea:
Temporal features in SQL:2011
http://cs.ulb.ac.be/public/_media/teaching/infoh415/tempfeaturessql2011.pdf
What's new in SQL:2011?
http://www.sigmod.org/publications/sigmod-record/1203/pdfs/10.industry.zemke.pdf
Temporal/Bi-Temporal SQL
116. About @MarkusWinand
Tuning developers for
high SQL performance
Training & tuning:
http://winand.at/
Author of:
http://sql-performance-explained.com/
Geeky blog:
http://use-the-index-luke.com