By expanding our knowledge of SQL facilities, we can let all the boring work be handled via SQL rather than a lot of middle-tier code, and we can get performance benefits as an added bonus. Here are some SQL techniques to solve problems that would otherwise require a lot of complex coding, freeing up your time to focus on the delivery of great applications.
Sangam 18 - Great Applications with Great SQLConnor McDonald
Get more out of the database by exploiting the rich suite of features available with the SQL language. We cover pivot, unpivot, rollup, pagination, error logging, query block naming
By expanding our knowledge of SQL facilities, we can let all the boring work be handled via SQL rather than a lot of middle-tier code, and we can get performance benefits as an added bonus. Here are some SQL techniques to solve problems that would otherwise require a lot of complex coding, freeing up your time to focus on the delivery of great applications.
Another year goes by, and most likely, another data access framework has been invented. It will claim to be the fastest, smartest way to talk to the database, and just like all those that came before it, it will not be. Because the best database access tool has been there for more than 30 years now, and that is PL/SQL. Although we all sometimes fall prey to the mindset of “Oh look, a shiny new tool, we should start using it," the performance and simplicity of PL/SQL remain unmatched. This session looks at the failings of other data access languages, why even a cursory knowledge of PL/SQL will make you a better developer, and how to get the most out of PL/SQL when it comes to database performance.
By expanding our knowledge of SQL facilities, we can let all the boring work be handled via SQL rather than a lot of middle-tier code, and we can get performance benefits as an added bonus. Here are some SQL techniques to solve problems that would otherwise require a lot of complex coding, freeing up your time to focus on the delivery of great applications.
Slides from the APEX Connect conference. This session covered the background of parsing a SQL statement, the risks and best practices, and an introduction to the read-consistency feature in the Oracle Database
Sangam 18 - Great Applications with Great SQLConnor McDonald
Get more out of the database by exploiting the rich suite of features available with the SQL language. We cover pivot, unpivot, rollup, pagination, error logging, query block naming
By expanding our knowledge of SQL facilities, we can let all the boring work be handled via SQL rather than a lot of middle-tier code, and we can get performance benefits as an added bonus. Here are some SQL techniques to solve problems that would otherwise require a lot of complex coding, freeing up your time to focus on the delivery of great applications.
Another year goes by, and most likely, another data access framework has been invented. It will claim to be the fastest, smartest way to talk to the database, and just like all those that came before it, it will not be. Because the best database access tool has been there for more than 30 years now, and that is PL/SQL. Although we all sometimes fall prey to the mindset of “Oh look, a shiny new tool, we should start using it," the performance and simplicity of PL/SQL remain unmatched. This session looks at the failings of other data access languages, why even a cursory knowledge of PL/SQL will make you a better developer, and how to get the most out of PL/SQL when it comes to database performance.
By expanding our knowledge of SQL facilities, we can let all the boring work be handled via SQL rather than a lot of middle-tier code, and we can get performance benefits as an added bonus. Here are some SQL techniques to solve problems that would otherwise require a lot of complex coding, freeing up your time to focus on the delivery of great applications.
Slides from the APEX Connect conference. This session covered the background of parsing a SQL statement, the risks and best practices, and an introduction to the read-consistency feature in the Oracle Database
Analytic SQL functions, or "window functions have been there since 8.1.6, but they are still dramatically underused by application developers. This session looks at the syntax and usage of analytic functions, and how they can supercharge your SQL skillset.
Covers analytics from their inception in 8.1.6 all the through to enhancements in 18 and 19
Slides from the ITOUG events in Rome and Milan 2020.
Most people think of the Flashback features in Oracle as the "In Case of Emergency" switch, to only be used when some catastrophe has occurred on your database. And while it is true that Flashback will definitely help you 3 seconds after you press the Commit button and you realise that you probably needed to have a WHERE clause on that "delete all rows from the SALES table" SQL statement. Or for when you run "drop table" on the Production database, when you were just so sure that you were logged onto the Test system. But Flashback is not only for those "Oh No!" moments. It enables benefits for developers ranging from data consistency to continuous integration and data auditing. Tucked away in Enterprise Edition are six independent and powerful technologies that might just save your career—they will also open up a myriad of other benefits of well.
Sangam 19 - Successful Applications on AutonomousConnor McDonald
The autonomous database offers insane levels of performance, but you won't be able to attain that if you are not constructing your SQL statements in a way that is scalable...and more importantly, secure from hacking
Perth APAC Groundbreakers tour - SQL TechniquesConnor McDonald
Get more out of the database by exploiting the rich suite of features available with the SQL language. We cover pivot, unpivot, rollup, pagination, error logging, query block naming
Sangam 18 - Database Development: Return of the SQL JediConnor McDonald
A look at the techniques that middle tier developers can employ to get greater value out of their applications, simply by having an understanding of how the database works and how to make it sing.
Kscope19 - Flashback: Good for Developers as well as DBAsConnor McDonald
Flashback is not only for those "Oh No!" moments when we make a mistake. It enables benefits for developers ranging from data consistency to continuous integration and data auditing. Tucked away in Enterprise Edition are six independent and powerful technologies that might just save your career—they will also open up a myriad of other benefits of well.
Explanations and examples of all of the flashback features available in the Oracle Database:
- flashback query
- flashback table
- flashback drop
- flashback database
- flashback transaction
- flashback data archive
These slides are from OpenWorld 2018. We covered
- conventional CONNECT BY syntax in Oracle
- extensions that were introduced in more recent versions
- the recursive WITH clause
Oracle trace data collection errors: the story about oceans, islands, and riversCary Millsap
When you execute a business task on a computer system, you create an experience. The duration of this experience is called response time. The richest and easiest information about response time to obtain in the whole Oracle technology stack is available from the Oracle Database tier: Oracle's extended SQL trace data. But in almost 100% of first tries with using trace data, people make a data collection mistake that complicates their analysis. This is the story of that mistake.
Most important "trick" of performance instrumentationCary Millsap
This is the material from my 10-minute TED-style talk 2014-09-29 at OakTable World held in conjunction with Oracle OpenWorld 2014 in San Francisco. It explains the importance of assigning a unique id to the Oracle Database code path associated with each performance experience that users can have with your system
No-one becomes an app developer to spend their days doing data processing. We do it to explore complex algorithms, build beautiful applications, and deliver fantastic solutions for our customers. But so often we don't ever get to realize that dream. We're too busy dealing with ORMs and hand-coding all the nuts and bolts of data processing so we're left with precious little time for anything else. There is a better way. By expanding our knowledge of SQL facilities, we can write a lot less middle-tier code, and get performance benefits as an added bonus. These slides highlights some SQL techniques to solve problems that would otherwise require a lot of complex coding, freeing up your time to focus on the delivery of great applications.
Wellington APAC Groundbreakers tour - SQL Pattern MatchingConnor McDonald
Analytic functions that came way back in 8i are cool, but often we use them really to answer questions about the patterns that exist in data. So perhaps it is time for a new SQL syntax - one more closely aligned with finding patterns, rather than analytical computations. Enter the MATCH_RECOGNIZE syntax!
Analytic SQL functions, or "window functions have been there since 8.1.6, but they are still dramatically underused by application developers. This session looks at the syntax and usage of analytic functions, and how they can supercharge your SQL skillset.
Covers analytics from their inception in 8.1.6 all the through to enhancements in 18 and 19
Slides from the ITOUG events in Rome and Milan 2020.
Most people think of the Flashback features in Oracle as the "In Case of Emergency" switch, to only be used when some catastrophe has occurred on your database. And while it is true that Flashback will definitely help you 3 seconds after you press the Commit button and you realise that you probably needed to have a WHERE clause on that "delete all rows from the SALES table" SQL statement. Or for when you run "drop table" on the Production database, when you were just so sure that you were logged onto the Test system. But Flashback is not only for those "Oh No!" moments. It enables benefits for developers ranging from data consistency to continuous integration and data auditing. Tucked away in Enterprise Edition are six independent and powerful technologies that might just save your career—they will also open up a myriad of other benefits of well.
Sangam 19 - Successful Applications on AutonomousConnor McDonald
The autonomous database offers insane levels of performance, but you won't be able to attain that if you are not constructing your SQL statements in a way that is scalable...and more importantly, secure from hacking
Perth APAC Groundbreakers tour - SQL TechniquesConnor McDonald
Get more out of the database by exploiting the rich suite of features available with the SQL language. We cover pivot, unpivot, rollup, pagination, error logging, query block naming
Sangam 18 - Database Development: Return of the SQL JediConnor McDonald
A look at the techniques that middle tier developers can employ to get greater value out of their applications, simply by having an understanding of how the database works and how to make it sing.
Kscope19 - Flashback: Good for Developers as well as DBAsConnor McDonald
Flashback is not only for those "Oh No!" moments when we make a mistake. It enables benefits for developers ranging from data consistency to continuous integration and data auditing. Tucked away in Enterprise Edition are six independent and powerful technologies that might just save your career—they will also open up a myriad of other benefits of well.
Explanations and examples of all of the flashback features available in the Oracle Database:
- flashback query
- flashback table
- flashback drop
- flashback database
- flashback transaction
- flashback data archive
These slides are from OpenWorld 2018. We covered
- conventional CONNECT BY syntax in Oracle
- extensions that were introduced in more recent versions
- the recursive WITH clause
Oracle trace data collection errors: the story about oceans, islands, and riversCary Millsap
When you execute a business task on a computer system, you create an experience. The duration of this experience is called response time. The richest and easiest information about response time to obtain in the whole Oracle technology stack is available from the Oracle Database tier: Oracle's extended SQL trace data. But in almost 100% of first tries with using trace data, people make a data collection mistake that complicates their analysis. This is the story of that mistake.
Most important "trick" of performance instrumentationCary Millsap
This is the material from my 10-minute TED-style talk 2014-09-29 at OakTable World held in conjunction with Oracle OpenWorld 2014 in San Francisco. It explains the importance of assigning a unique id to the Oracle Database code path associated with each performance experience that users can have with your system
No-one becomes an app developer to spend their days doing data processing. We do it to explore complex algorithms, build beautiful applications, and deliver fantastic solutions for our customers. But so often we don't ever get to realize that dream. We're too busy dealing with ORMs and hand-coding all the nuts and bolts of data processing so we're left with precious little time for anything else. There is a better way. By expanding our knowledge of SQL facilities, we can write a lot less middle-tier code, and get performance benefits as an added bonus. These slides highlights some SQL techniques to solve problems that would otherwise require a lot of complex coding, freeing up your time to focus on the delivery of great applications.
Wellington APAC Groundbreakers tour - SQL Pattern MatchingConnor McDonald
Analytic functions that came way back in 8i are cool, but often we use them really to answer questions about the patterns that exist in data. So perhaps it is time for a new SQL syntax - one more closely aligned with finding patterns, rather than analytical computations. Enter the MATCH_RECOGNIZE syntax!
Slides from the ILOUG 2019 conference. At every conference, you’ll see plenty about the latest and greatest release of Oracle. You’ll sigh as you think that it will be 10 years before you get to these versions at your workplace. This presentation is for you – we’ll look at the cool underused SQL features available going all the way back to Oracle 8.
Slides from the APEXConnect 2018 conference in Dusseldorf.
APEX is amazing and most SQL is taken care of automatically. But by delving a little deeper into more advanced SQL facilities, we can get performance benefits and write a lot less middle-tier code. This session highlights some SQL techniques to solve problems that would otherwise require a lot of complex coding. Learn how to become a more productive developer by expanding your knowledge of the SQL language.
Wellington APAC Groundbreakers tour - Upgrading to the 12c OptimizerConnor McDonald
The 12c optimizer has a vast array of improvements, but of course, functionality changes means that your SQL plans might also change when you upgrade. This slidedeck covers what has changed, and how to ensure better more stable performance when you upgrade.
OpenWorld 2018 - Common Application Developer DisastersConnor McDonald
Two of the critical requirements of a database are:
- run fast
- data integrity
The database can achieve these things, but only as long as you understand the mechanisms correctly. If you don't, then things can go downhill fast.
Melbourne Groundbreakers Tour - Upgrading without riskConnor McDonald
The 12c optimizer has a vast array of improvements, but of course, functionality changes means that your SQL plans might also change when you upgrade. This slidedeck covers what has changed, and how to ensure better more stable performance when you upgrade.
The 12c optimizer has a vast array of improvements, but of course, functionality changes means that your SQL plans might also change when you upgrade. This slidedeck covers what has changed, and how to ensure better more stable performance when you upgrade.
Slides from OOW13
Its the age old problem. The SQL statement that needs to run in 5 seconds - unfortunately runs in 10 seconds, or 10 minutes, or 10 hours. A SQL statement gets emailed to you with the simple subject title: "Make it faster". We'll start from this point in the process, and look at what you can do to tackle this common issue.
For most developers, knowledge of PL/SQL starts from writing user-defined functions. As a result, even if this code is functionally correct, the program units are fired significantly more often than needed, impact CBO decisions, and cause execution plan degradation. This section addresses these issues and includes a number of examples of how PL/SQL can extend basic SQL functionality.
Similar to Latin America Tour 2019 - 10 great sql features (20)
APEX tour 2019 - successful development with autonomousConnor McDonald
The autonomous database offers insane levels of performance, but you won't be able to attain that if you are not constructing your SQL statements in a way that is scalable...and more importantly, secure from hacking
Apologies for most pics missing and awful layout...you can thank slideshare for that :-(
Slides from the APAC Groundbreakers Tour from Perth and Melbourne legs. This session covered the features in 18c, 19c and 20c, along with the new free database offerings from Oracle from OpenWorld 2019
Slides from OpenWorld. Flashback has been around for long time yet people assume it should entirely within the realm of the DBA. But with modern development techniques such as continuous integration/continuous deployment, flashback actually is a perfect for *developers*
Slides from the OpenWorld talk on read consistency. It is the feature that makes Oracle such a great database for performance and concurrency. But if misunderstood, it can lead to confusion for developers
Slides from OpenWorld 2019. Want to make sure your applications are slow, burn lots of CPU, and are easily broken into by hackers? Well...in reality, if you know how to do this, then you'll know how to avoid it.
Slides from Openworl 2019. A look at how to safely (and unsafely) kill sessions in the Oracle database, and how to perhaps avoid killing them altogether.
Flashback is not only for those "Oh No!" moments when we make a mistake. It enables benefits for developers ranging from data consistency to continuous integration and data auditing. Tucked away in Enterprise Edition are six independent and powerful technologies that might just save your career—they will also open up a myriad of other benefits of well.
Latin America Tour 2019 - slow data and sql processingConnor McDonald
Well done! You've come up with the killer idea for 2020. You've got the best UI design anyone has ever seen! Your modern application ticks all the boxes — serverless, functional, Kubernetes, microservices, API-based, the list goes on. It runs on every OS and every type of device. But unfortunately, all of this counts for absolutely NOTHING if your data access is slow or buggy. But an Autonomous database will fix all that right? Only if you understand the fundamentals of how SQL is processed by the database. For novice developers, SQL can be hard to understand and sometimes totally hidden from view under an ORM. Let's peel back the covers to show how SQL is processed, how to avoid getting hacked, and how to get data back to your application in a snappy fashion.
OG Yatra - upgrading to the new 12c+ optimizerConnor McDonald
The 12c optimizer has a vast array of improvements, but of course, functionality changes means that your SQL plans might also change when you upgrade. This slidedeck covers what has changed, and how to ensure better more stable performance when you upgrade.
The skill set of a database practitioner is much more than what is read in the documentation, on blogs, or on StackOverflow. It is the knowledge from years of trial and error, experimentation, and sometimes painful failures. The problem is it takes time—a long, long time—to build that experience. This session aims to fast-track that path. Get a collection of hints, tips, features, and techniques picked up from the smartest people in the community.
OG Yatra - Flashback, not just for developersConnor McDonald
Flashback is not only for those "Oh No!" moments when we make a mistake. It enables benefits for developers ranging from data consistency to continuous integration and data auditing. Tucked away in Enterprise Edition are six independent and powerful technologies that might just save your career—they will also open up a myriad of other benefits of well.
Kscope19 - Understanding the basics of SQL processingConnor McDonald
Better data access typically means understanding how SQL is processed by the database, and who has time for that? Let's peel back the covers to show how SQL is processed, how to avoid getting hacked, and how to get data back to your application in a snappy fashion.
Slides from the Oracle ANZ workshop held in Sydney and Melbourne. We look at the killer features that will make 18c and 19c great productivity upgrades for DBAs
APEX Connect 2019 - array/bulk processing in PLSQLConnor McDonald
A beginners level talk at the syntax for bulk processing in PLSQL, why it is so important for performance and scalability, and how to diagnose errors when it goes wrong
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
28. 28
"fine-grained to perform a single function"
"Each service is ... minimal, and complete"
https://en.wikipedia.org/wiki/Microservices
select COUNT(*)
from PEOPLE
where GENDER = 'MALE'
multa-granulado para realizar una sola función
Cada servicio es ... mínimo y completo
32. 32
"By abstracting the underlying implementation"
"describes the expected behaviour ... but can have multiple implementations"
https://en.wikipedia.org/wiki/Application_programming_interface
select NAME, STREET_NO, ZIP_CODE
from PEOPLE p,
ADDRESS a
where p.AGE > 50
and p.ADDRESS_ID = a.ADDRESS_ID;
Al abstraer la implementación subyacente
describe el comportamiento esperado ... pero puede tener múltiples implementaciones
37. SQL> with x( s, ind ) as
2 ( select sud, instr( sud, '.' )
3 from ( select replace(replace(
4 replace(replace(:board,'-'),'|'),' '),chr(10)) sud
5 from dual )
6 union all
7 select substr(s,1,ind-1)||z||substr(s,ind+1)
8 , instr(s,'.',ind+1)
9 from x
10 , ( select to_char( rownum ) z
11 from dual connect by rownum <= 9 ) z
12 where ind > 0
13 and not exists (
14 select null
15 from ( select rownum lp from dual
16 connect by rownum <= 9 )
17 where z = substr(s,trunc((ind-1)/9)*9+lp,1)
45
38. 18 or z = substr(s,mod(ind-1,9)-8+lp*9,1)
19 or z = substr(s,mod(trunc((ind-1)/3),3)*3
20 +trunc((ind-1)/27)*27+lp
21 +trunc((lp-1)/3)*6,1)
22 )
23 ),
24 result as (
25 select s
26 from x
27 where ind = 0 )
28 select
29 regexp_replace(substr(s,(idx-1)*9+1,9),
30 '(...)(...)(...)',
31 '1|2|3')||
32 case when mod(idx,3)=0 then chr(10)||rpad('-',11,'-') end soln
33 from result,
34 ( select level idx
35 from dual
36 connect by level <= 9 )
46
Ack: Anton Scheffer,
https://technology.amis.nl
41. 49
100%
% of developers that
will need to solve Sudoku
as part of their job
% de desarrolladores que
tendrá que resolver Sudoku
como parte de su trabajo
42. 50
100%
% of developers that need
to get real work done
% de desarrolladores que necesitan
llegar trabajo de verdad hecho
53. "Employee salary list,
plus department total,
plus grand total"
61
"Lista de salario del empleado,
más el total del departamento,
más el gran total "
74. SQL> insert into MY_TABLE
2 select *
3 from MY_HUGE_GREAT_FAT_TABLE;
Elapsed: 06:12:34.00
82
75. SQL> insert into MY_TABLE
2 select *
3 from MY_HUGE_GREAT_FAT_TABLE;
Elapsed: 06:12:34.00
ERROR at line 1:
ORA-01847: day of month must be between 1 and last day of month
83
84. SQL> insert into MY_TABLE
2 select *
3 from MY_HUGE_GREAT_FAT_TABLE
4 where "not a duplicate"
5 and "datatypes are ok"
6 and "foreign keys are ok"
7 and "check constraints are ok"
92
99. 107
SQL> SELECT hrs.hr, t1.room, t1.who
2 from timeslots hrs
3 left outer join bookings t1
4 on hrs.hr = t1.hr
5 order by 1
HR ROOM WHO
------- ---------- ----------
8 Room2 PETE
9 Room1 JOHN
10
11 Room1 MIKE
12
13
14 Room2 JILL
15 Room2 JANE
16 Room1 SAM
107
119. "data is represented as mathematical n-ary
relations, an n-ary relation being a subset of the
Cartesian product of n domains."
127
"los datos se representan como matemáticos n-ary
relaciones, una n-ary relación siendo un subconjunto
de la Producto cartesiano de n dominios ".
123. "First, get the total salary paid by each department,
then get the average of these totals,
then list those departments above that average"
131
SQL ?
"primero, obtenga el salario total pagado por cada departamento,
entonces obtener el promedio de estos totales,
entonces enumerar esos departamentos por encima de ese promedio "
124. "First, get the total salary paid by department...
SQL> WITH dept_salaries AS (
2 SELECT dname, SUM(sal) dept_sal
3 FROM emp e, dept d
4 WHERE e.deptno = d.deptno
5 GROUP BY dname),
132
125. "...then get the average of these totals...
6 avg_sal AS ( SELECT AVG(dept_sal) avsal
7 FROM dept_salaries)
133
126. "...then list those departments above average."
8 SELECT * FROM dept_salaries d, avg_sal a
9 WHERE d.dept_sal > a.avsal
10 ORDER BY d.dname;
134
127. SQL> WITH dept_salaries AS (
2 SELECT dname, SUM(sal) dept_sal
3 FROM emp e, dept d
4 WHERE e.deptno = d.deptno
5 GROUP BY dname),
6 avg_sal AS ( SELECT AVG(dept_sal) avsal
7 FROM dept_salaries)
8 SELECT * FROM dept_salaries d, avg_sal a
9 WHERE d.dept_sal > a.avsal
10 ORDER BY d.dname;
135
145. "That’s wrong!...surely you know
I wanted it DOWN the page"
153
"Eso está mal! ... seguramente lo sabes
yo lo queria ABAJO la página"
146. SQL> desc SALES_ACROSS
Name Null? Type
----------------------------- -------- -------------
PRODUCT VARCHAR2(20)
Q1 NUMBER
Q2 NUMBER
Q3 NUMBER
Q4 NUMBER
154
150. most of us know about analytics
158
la mayoría de nosotros sabemos sobre análisis
151. SQL> select row_number() OVER ( order by sal )
2 from emp
3 ...
159
https://bit.ly/analytic_sql
152. 160
"Show me lowest salary for each department..."
SQL> select deptno, min(sal)
2 from emp
3 group by deptno;
"...and I need to know who has that lowest salary"
SQL> select deptno, empno, min(sal)
2 from emp
3 group by deptno;
ORA-00979: not a GROUP BY expression
Muéstrame el salario más bajo para cada departamento ...
... y necesito saber quién tiene el salario más bajo
154. SQL> select deptno, min(sal), min(empno)
2 KEEP ( dense_rank FIRST order by sal) empno
3 from emp
4 group by deptno
5 /
DEPTNO MIN(SAL) EMPNO
---------- ---------- ----------
10 1300 7934
20 800 7369
30 950 7900
Emp 7934 has the
lowest salary in dept 10
162
Emp 7934 tiene el salario más
bajo en el departamento 10
163. SQL> select *
2 from customers
3 where cust_name = 'ADAMS';
COUNTRY CREATED CUST_NAME
------------ --------- ------------
AUS 07-NOV-16 ADAMS
164. SQL> select *
2 from customers
3 where upper(cust_name) = 'ADAMS';
COUNTRY CREATED CUST_NAME
------------ --------- ------------
AUS 07-NOV-16 Adams
AUS 07-NOV-16 ADAMS
AUS 07-NOV-16 adams
169. SQL> create index cust_ix
2 on customers ( cust_name );
Index created.
SQL> create index cust_ix2
2 on customers ( upper(cust_name) );
Index created.
178. SQL> create index cust_ix
2 on customers ( cust_name);
Index created.
SQL> set autotrace traceonly explain
SQL> select * from customers
2 where cust_name = 'ADAMS';
-----------------------------------------------------------------
| Id | Operation | Name | Rows |
-----------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 |
| 1 | TABLE ACCESS BY INDEX ROWID BATCHED| CUSTOMERS | 1 |
|* 2 | INDEX RANGE SCAN | CUST_IX | 1 |
-----------------------------------------------------------------
179. 187
"what is so special about that?"
Qué tiene de especial eso?
180. SQL> select * from customers
2 where cust_name = 'ADAMS';
COUNTRY CREATED CUST_NAME
------------ --------- ----------------
AUS 07-NOV-16 Adams
AUS 08-NOV-16 ADAMS
AUS 09-NOV-16 adams
181. 189
binary_ci
SQL> select * from customers
2 where cust_name = 'ADAMS';
COUNTRY CREATED CUST_NAME
------------ --------- ------------
AUS 07-NOV-16 Adams
AUS 08-NOV-16 ADAMS
AUS 09-NOV-16 adams
182. 190
binary_ai
SQL> select * from customers
2 where cust_name = 'ADAMS';
COUNTRY CREATED CUST_NAME
------------ --------- -----------
AUS 07-NOV-16 Adams
AUS 08-NOV-16 ADAMS
AUS 09-NOV-16 adams
AUS 10-NOV-16 adáms
adáms
195. select emp.*
from emp,
( select trunc(hiredate,'YYYY'), max(empno) empno
from emp
where empno > 0
group by trunc(hiredate,'YYYY') ) x,
( select deptno, avg(sal)
from emp
group by deptno ) y
where x.empno = emp.empno
and y.deptno = emp.deptno
203
196. Id | Operation | Name |
----------------------------------------------|
0 | SELECT STATEMENT | |
1 | HASH JOIN | |
2 | TABLE ACCESS BY INDEX ROWID | EMP |
3 | NESTED LOOPS | |
4 | VIEW | |
5 | SORT GROUP BY | |
6 | TABLE ACCESS BY INDEX ROWID| EMP |
7 | INDEX FULL SCAN | E2 |
8 | INDEX RANGE SCAN | E1 |
9 | VIEW | |
10 | SORT GROUP BY | |
11 | TABLE ACCESS BY INDEX ROWID | EMP |
12 | INDEX RANGE SCAN | E2 |
204
197. ?
205
select emp.*
from emp,
( select trunc(hiredate,'YYYY'), max(empno) empno
from emp
where empno > 0
group by trunc(hiredate,'YYYY') ) x,
( select deptno, avg(sal)
from emp
group by deptno ) y
where x.empno = emp.empno
and y.deptno = emp.deptno
Id | Operation | Name |
----------------------------------------------|
0 | SELECT STATEMENT | |
1 | HASH JOIN | |
2 | TABLE ACCESS BY INDEX ROWID | EMP |
3 | NESTED LOOPS | |
4 | VIEW | |
5 | SORT GROUP BY | |
6 | TABLE ACCESS BY INDEX ROWID| EMP |
7 | INDEX FULL SCAN | E2 |
8 | INDEX RANGE SCAN | E1 |
9 | VIEW | |
10 | SORT GROUP BY | |
11 | TABLE ACCESS BY INDEX ROWID | EMP |
12 | INDEX RANGE SCAN | E2 |
198. select emp.*
from emp,
( select /*+ QB_NAME(YR_HIRE) */
trunc(hiredate,'YYYY'), max(empno) empno
from emp
where empno > 0
group by trunc(hiredate,'YYYY') ) x,
( select /*+ QB_NAME(AV_SAL) */
deptno, avg(sal)
from emp
group by deptno ) y
where x.empno = emp.empno
and y.deptno = emp.deptno
206
select emp.*
from emp,
( select /*+ QB_NAME(YR_HIRE) */
trunc(hiredate,'YYYY'), max(empno) empno
from emp
where empno > 0
group by trunc(hiredate,'YYYY') ) x,
( select /*+ QB_NAME(AV_SAL) */
deptno, avg(sal)
from emp
group by deptno ) y
where x.empno = emp.empno
and y.deptno = emp.deptno
199. Id | Operation | Name | Query Block
----------------------------------------------|--------------
0 | SELECT STATEMENT | |
1 | HASH JOIN | |
2 | TABLE ACCESS BY INDEX ROWID | EMP |
3 | NESTED LOOPS | |
4 | VIEW | |
5 | SORT GROUP BY | |
6 | TABLE ACCESS BY INDEX ROWID| EMP |
7 | INDEX FULL SCAN | E2 |
8 | INDEX RANGE SCAN | E1 |
9 | VIEW | |
10 | SORT GROUP BY | |
11 | TABLE ACCESS BY INDEX ROWID | EMP |
12 | INDEX RANGE SCAN | E2 |
SEL$1
SEL$1
AV_SAL
AV_SAL
AV_SAL
AV_SAL
SEL$1
YR_HIRE
YR_HIRE
YR_HIRE
YR_HIRE
207
203. "if I was paid $3000,
then where would I rank in
each department?"
"si me pagaran $ 3000,
entonces, dónde clasificaría en
cada departamento?"
204. SQL> select
2 deptno,
3 rank(3000) within group
4 ( order by sal ) as ranking
5 from emp
6 group by deptno;
DEPTNO RANKING
---------- ----------
10 2
20 4
30 7
40 2
208. 216
SQL> select dt, val
2 from t
3 order by dt;
DT VAL
--------- ----------
02-JAN-11 195
03-JAN-11
04-JAN-11
05-JAN-11
06-JAN-11 129
07-JAN-11
08-JAN-11
09-JAN-11
10-JAN-11 87
11-JAN-11
...
195
195
195
129
129
129
87
209. 217
SQL> select dt, val,
2 case when val is not null
3 then to_char(row_number() over (order by dt),'fm0000')||'-'||val
4 end max_val
5 from t
6 order by dt;
DT VAL MAX_VAL
--------- ---------- -----------
02-JAN-11 195 0001-195
03-JAN-11
04-JAN-11
05-JAN-11
06-JAN-11 129 0005-129
07-JAN-11
08-JAN-11
09-JAN-11
10-JAN-11 87 0009-87
11-JAN-11
...
210. 218
SQL> select dt, val,
2 max(max_val) over (order by dt) max_val_str
3 from ( select dt, val,
4 case when val is not null
5 then to_char(row_number() over (order by dt),'fm0000')||'-'||val
6 end max_val
7 from t ) order by dt;
DT VAL MAX_VAL_STR
--------- ---------- ------------------
02-JAN-11 195 0001-195
03-JAN-11 0001-195
04-JAN-11 0001-195
05-JAN-11 0001-195
06-JAN-11 129 0005-129
07-JAN-11 0005-129
08-JAN-11 0005-129
09-JAN-11 0005-129
10-JAN-11 87 0009-87
11-JAN-11 0009-87
...
211. 219
SQL> select dt, val,
2 to_number(substr(max(max_val) over (order by dt),5)) max_val
3 from ( select dt, val,
4 case when val is not null
5 then to_char(row_number() over (order by dt),'fm0000')||val
6 end max_val
7 from t ) order by dt
8 /
DT VAL MAX_VAL
--------- ---------- ----------
02-JAN-11 195 195
03-JAN-11 195
04-JAN-11 195
05-JAN-11 195
06-JAN-11 129 129
07-JAN-11 129
08-JAN-11 129
09-JAN-11 129
10-JAN-11 87 87
11-JAN-11 87
212. 220
SQL> select dt, val,
2 last_value(val ignore nulls) over (order by dt) val
3 from t
4 order by dt;
DT VAL VAL
--------- ---------- ----------
02-JAN-11 195 195
03-JAN-11 195
04-JAN-11 195
05-JAN-11 195
06-JAN-11 129 129
07-JAN-11 129
08-JAN-11 129
09-JAN-11 129
10-JAN-11 87 87
11-JAN-11 87
230. SQL> select
2 ( select dname
3 from dept
4 where deptno = e.deptno ) dname,
5 decode(empno, 7499,
6 ( select max(sal) from emp ),
7 -1)
8 from
9 ( select * from emp
10 where sal > 0 ) e
11 where
12 ( select max(hiredate) from emp ) < sysdate
13 /
scalar
anywhere an
expression could be
238
231. "I am not impressed"
239
"No estoy impresionado"
232. SQL> create or replace
2 function CALC_TAX(p int) return number is
3 begin
4 dbms_lock.sleep(1);
5 return p;
6 end;
7 /
Function created.
240
233. SQL> create table T
2 as select rownum r, mod(rownum,5) r1 from dual
3 connect by level <= 30;
Table created.
1,2,3,..., 30
0,1,2,3,4,0,1,2,3,4, ...
241
243. select prod_id, max(amount)
from stores st,
customers c,
sales s
where s.cust_id = c.cust_id(+)
and c.store_id = st.store_id
and s.amount > 10
group by prod_id
251
hash outer join ? nested loop ?
STORES first ?
sort merge ?