Deep Dive into Oracle 12c Pattern Matching

Size: px
Start display at page:

Download "Deep Dive into Oracle 12c Pattern Matching"

Transcription

1 Deep Dive into Oracle 12c Pattern Matching Oren Nakdimon

2 Who Am I? a chronology by Oracle years When What Where Oracle 6/ Developer IAF Oracle Server Group Manager Golden Screens Oracle 8i/9i DBA Group Manager TELEknowledge Oracle 10g/11g VP R&D and Israel Site Manager Olista Oracle 11g/12c Freelance Consultant Database Expert [English] [Hebrew]

3 Agenda SQL analytics evolution The MATCH_RECOGNIZE clause 3

4 The Usual Warning Before you decide to apply any of the presented features in production, make sure: to thoroughly test them for your applications and environments that you have the required license to use them

5 SQL Analytics Evolution

6 The Most Basic SQL Row-level visibility Maximum one output row per input row WHERE clause

7 Aggregate Functions Group-level visibility Strict definition of group Each input row belongs to exactly one group Maximum one output row per group GROUP BY clause HAVING clause

8 Analytic (Window) Functions Window-level visibility Strict definition of window Each input row has its own window Window-level aggregates are added to input rows OVER PARTITION BY ORDER BY

9 Pattern Matching Enhanced analysis of row sequences Match-based output One row per match (similar to the group by concept) or All the match s input rows (similar to the window concept) Each input row may belong to 0, 1 or more matches

10 Find all the employees in department 30 The obvious solution is: SELECT * FROM EMP WHERE DEPTNO = 30 But that is too easy ;-)

11 Find all the employees in department 30 Pattern Variable EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7369 SMITH CLERK /12/ ALLEN SALESMAN /02/ SELECT * FROM EMP MATCH_RECOGNIZE ( ALL ROWS PER MATCH PATTERN (D30) DEFINE D30 AS DEPTNO=30 ) 7521 WARD SALESMAN /02/ JONES MANAGER /04/ MARTIN SALESMAN /09/ BLAKE MANAGER /05/ CLARK MANAGER /06/ SCOTT ANALYST /04/ KING PRESIDENT 17/11/ TURNER SALESMAN /09/ ADAMS CLERK /05/ JAMES CLERK /12/ FORD ANALYST /12/ MILLER CLERK /01/ D30

12 Find 2 employees hired successively to department 30 order by Pattern Variable 1 2 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7369 SMITH CLERK /12/ ALLEN SALESMAN /02/ SELECT * FROM EMP MATCH_RECOGNIZE ( ORDER BY HIREDATE ALL ROWS PER MATCH PATTERN (D30{2}) D30) DEFINE D30 AS DEPTNO=30 ) 7521 WARD SALESMAN /02/ JONES MANAGER /04/ BLAKE MANAGER /05/ CLARK MANAGER /06/ TURNER SALESMAN /09/ MARTIN SALESMAN /09/ KING PRESIDENT 17/11/ JAMES CLERK /12/ FORD ANALYST /12/ MILLER CLERK /01/ SCOTT ANALYST /04/ ADAMS CLERK /05/ D30

13 PATTERN (Greedy) Quantifiers Pattern Number of consecutive occurrences X 1 X{n} n X+ 1 or more X{n,} n or more X{n,m} between n and m X{,m} between 0 and m X* 0 or more X? 0 or 1

14 Find one or more employees hired successively to department 30 order by Pattern Variable EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7369 SMITH CLERK /12/ ALLEN SALESMAN /02/ SELECT * FROM EMP MATCH_RECOGNIZE ( ORDER BY HIREDATE ALL ROWS PER MATCH PATTERN (D30+) DEFINE D30 AS DEPTNO=30 ) 7521 WARD SALESMAN /02/ JONES MANAGER /04/ BLAKE MANAGER /05/ CLARK MANAGER /06/ TURNER SALESMAN /09/ MARTIN SALESMAN /09/ KING PRESIDENT 17/11/ JAMES CLERK /12/ FORD ANALYST /12/ MILLER CLERK /01/ SCOTT ANALYST /04/ ADAMS CLERK /05/ D30

15 Multiple Pattern Variables order by Pattern Variables EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7369 SMITH CLERK /12/ ALLEN SALESMAN /02/ SELECT * FROM EMP MATCH_RECOGNIZE ( ORDER BY HIREDATE ALL ROWS PER MATCH PATTERN (D30 D20 LS?) DEFINE D30 AS DEPTNO=30, D20 AS DEPTNO=20, LS AS SAL<=1500 ) 7521 WARD SALESMAN /02/ JONES MANAGER /04/ BLAKE MANAGER /05/ CLARK MANAGER /06/ TURNER SALESMAN /09/ MARTIN SALESMAN /09/ KING PRESIDENT 17/11/ JAMES CLERK /12/ FORD ANALYST /12/ MILLER CLERK /01/ SCOTT ANALYST /04/ ADAMS CLERK /05/ D30 D20 LS

16 Dividing the Input Row Set order by partition by Pattern Variables EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7782 CLARK MANAGER /06/ KING PRESIDENT 17/11/ SELECT * FROM EMP MATCH_RECOGNIZE ( PARTITION BY DEPTNO ORDER BY HIREDATE ALL ROWS PER MATCH PATTERN (HS+ LS*) DEFINE LS AS SAL<=1500, HS AS SAL> 1500 ) 7934 MILLER CLERK /01/ SMITH CLERK /12/ JONES MANAGER /04/ FORD ANALYST /12/ SCOTT ANALYST /04/ ADAMS CLERK /05/ ALLEN SALESMAN /02/ WARD SALESMAN /02/ BLAKE MANAGER /05/ TURNER SALESMAN /09/ MARTIN SALESMAN /09/ JAMES CLERK /12/ LS HS

17 Adding Measures order by partition by Pattern Variables EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7782 CLARK MANAGER /06/ SELECT * FROM EMP MATCH_RECOGNIZE ( PARTITION BY DEPTNO ORDER BY HIREDATE MEASURES MATCH_NUMBER() as MATCH# ALL ROWS PER MATCH PATTERN AFTER MATCH (HS+ SKIP LS*) PAST LAST ROW DEFINE PATTERN LS (HS+ AS SAL<=1500, LS*) DEFINE LS HS AS SAL<=1500, SAL> ) HS AS SAL> 1500 ) 7839 KING PRESIDENT 17/11/ MILLER CLERK /01/ SMITH CLERK /12/ JONES MANAGER /04/ FORD ANALYST /12/ SCOTT ANALYST /04/ ADAMS CLERK /05/ ALLEN SALESMAN /02/ WARD SALESMAN /02/ BLAKE MANAGER /05/ TURNER SALESMAN /09/ MARTIN SALESMAN /09/ JAMES CLERK /12/ LS HS

18 AFTER MATCH SKIP PAST LAST ROW (the default) TO NEXT ROW TO FIRST var TO [LAST] var

19 Adding Measures order by partition by Pattern Variables EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7782 CLARK MANAGER /06/ SELECT * FROM EMP MATCH_RECOGNIZE ( PARTITION BY DEPTNO ORDER BY HIREDATE MEASURES MATCH_NUMBER() as MATCH# ALL ROWS PER MATCH PATTERN AFTER MATCH (HS+ SKIP LS*) TO NEXT ROW DEFINE PATTERN LS (HS+ AS SAL<=1500, LS*) DEFINE LS HS AS SAL<=1500, SAL> ) HS AS SAL> 1500 ) 7839 KING PRESIDENT 17/11/ MILLER CLERK /01/ SMITH CLERK /12/ JONES MANAGER /04/ FORD ANALYST /12/ SCOTT ANALYST /04/ ADAMS CLERK /05/ ALLEN SALESMAN /02/ WARD SALESMAN /02/ BLAKE MANAGER /05/ TURNER SALESMAN /09/ MARTIN SALESMAN /09/ JAMES CLERK /12/ LS HS

20 Uniting Adjacent Periods KNESSET_ NUMBER PRIME_MINISTER START_DATE END_DATE 0 דוד בן-גוריון 14/05/ /03/ דוד בן-גוריון 10/03/ /11/ דוד בן-גוריון 01/11/ /10/ דוד בן-גוריון 08/10/ /12/ דוד בן-גוריון 24/12/ /01/ משה שרת 26/01/ /06/ משה שרת 29/06/ /11/ דוד בן-גוריון 03/11/ /01/ דוד בן-גוריון 07/01/ /12/ דוד בן-גוריון 17/12/ /11/ דוד בן-גוריון 02/11/ /06/ לוי אשכול 26/06/ /12/ לוי אשכול 22/12/ /01/ לוי אשכול 12/01/ /02/ גולדה מאיר 17/03/ /12/ גולדה מאיר 15/12/ /03/ גולדה מאיר 10/03/ /06/ יצחק רבין 03/06/ /06/ מנחם בגין 20/06/ /08/ מנחם בגין 05/08/ /10/ יצחק שמיר 10/10/ /09/1984

21 partition by SELECT KNESSET_NUMBER, order by KNESSET_ NUMBER PRIME_MINISTER START_DATE, START_DATE END_DATE 17 END_DATE, 04/05/ /03/2009 אהוד אולמרט 15 PRIME_MINISTER, 06/07/ /03/2001 אהוד ברק 15 CONT_PERIOD#, 07/03/ /02/2003 אריאל שרון 16 CONT_PERIOD_START, 28/02/2003 אריאל שרון 16/04/ CONT_PERIOD_END 18/06/1996 בנימין נתניהו 06/07/ נתניהוFROM ISRAEL_CABINETS 31/03/2009 בנימין 18/03/2013 ( 18/03/2013 בנימין נתניהו 19 MATCH_RECOGNIZE 14/05/ PARTITION בנימין נתניהו BY 14/05/2015 PRIME_MINISTER 17/03/ /12/1969 גולדה מאיר 6 ORDER BY START_DATE 15/12/ /03/1974 גולדה מאיר 7 MEASURES MATCH_NUMBER() 10/03/ /06/1974 גולדה מאיר 8 FIRST(START_DATE) 14/05/ /03/1949 דוד בן- גוריון 0 10/03/ /11/1950 דוד בן- גוריון 1 1 ALL גוריון ROWS דוד בן- PER 01/11/1950 MATCH 08/10/ PATTERN בן- גוריון STRT )דוד 08/10/1951 NXT*) 24/12/ דוד בן- גוריון 24/12/ /01/ ) דוד בן- גוריון 03/11/ /01/ ORDER גוריון BY דוד בן- START_DATE; 07/01/ /12/ דוד בן- גוריון 17/12/ /11/ דוד בן- גוריון 02/11/ /06/ יצחק רבין 03/06/ /06/ יצחק רבין 13/07/ /11/1995 NXT CONT_PERIOD#, CONT_PERIOD_START, FINAL LAST(END_DATE) CONT_PERIOD_END DEFINE NXT AS START_DATE = PREV(END_DATE)

22 ONE ROW PER MATCH SELECT * FROM ISRAEL_CABINETS MATCH_RECOGNIZE ( PARTITION BY PRIME_MINISTER ORDER BY START_DATE MEASURES MATCH_NUMBER() CONT_PERIOD#, FIRST(START_DATE) CONT_PERIOD_START, LAST(END_DATE) CONT_PERIOD_END ONE ROW PER MATCH PATTERN (STRT NXT*) DEFINE NXT AS START_DATE = PREV(END_DATE) ) ORDER BY CONT_PERIOD_START;

23 Fibonacci Numbers X F SELECT * FROM (select rownum X from dual connect by level<=100) MATCH_RECOGNIZE ( ORDER BY X MEASURES CLASSIFIER() AS F_OR_NOT ALL ROWS PER MATCH PATTERN ((F NF)+) DEFINE F AS (X = 1 OR X = 2 OR X = LAST(F.X,1) + LAST(F.X,2)) ); Pattern Alternation

24 Only Fibonacci Numbers X F SELECT * FROM (select rownum X from dual connect by level<=100) MATCH_RECOGNIZE ( ORDER BY X MEASURES CLASSIFIER() AS F_OR_NOT ALL ROWS PER MATCH PATTERN ((F {-NF-})+) DEFINE F AS (X = 1 OR X = 2 OR X = LAST(F.X,1) + LAST(F.X,2)) ); Pattern Exclusion

25 Count Fibonacci Numbers X F SELECT * FROM (select rownum X from dual connect by level<=100000) MATCH_RECOGNIZE ( ORDER BY X MEASURES COUNT(F.X) AS F_COUNT ALL ROWS PER MATCH PATTERN ((F NF)+) DEFINE F AS (X = 1 OR X = 2 OR X = LAST(F.X,1) + LAST(F.X,2)) );

26 Thank You Oren Nakdimon

Producing Readable Output with SQL*Plus

Producing Readable Output with SQL*Plus Producing Readable Output with SQL*Plus Chapter 8 Objectives After completing this lesson, you should be able to do the following: Produce queries that require an input variable Customize the SQL*Plus

More information

Chapter 1. Writing Basic. SQL Statements

Chapter 1. Writing Basic. SQL Statements Chapter 1 Writing Basic SQL Statements 1 Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB Outline Database concepts Conceptual Design Logical Design Communicating with the RDBMS 2 Some concepts Database: an

More information

Subqueries Chapter 6

Subqueries Chapter 6 Subqueries Chapter 6 Objectives After completing this lesson, you should be able to do the follovving: Describe the types of problems that subqueries can solve Define subqueries List the types of subqueries

More information

Oracle 12c New Features For Developers

Oracle 12c New Features For Developers Oracle 12c New Features For Developers Presented by: John Jay King Download this paper from: 1 Session Objectives Learn new Oracle 12c features that are geared to developers Know how existing database

More information

Displaying Data from Multiple Tables. Chapter 4

Displaying Data from Multiple Tables. Chapter 4 Displaying Data from Multiple Tables Chapter 4 1 Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equality

More information

Displaying Data from Multiple Tables

Displaying Data from Multiple Tables Displaying Data from Multiple Tables 1 Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using eguality and

More information

Database Access from a Programming Language: Database Access from a Programming Language

Database Access from a Programming Language: Database Access from a Programming Language Database Access from a Programming Language: Java s JDBC Werner Nutt Introduction to Databases Free University of Bozen-Bolzano 2 Database Access from a Programming Language Two Approaches 1. Embedding

More information

Database Access from a Programming Language:

Database Access from a Programming Language: Database Access from a Programming Language: Java s JDBC Werner Nutt Introduction to Databases Free University of Bozen-Bolzano 2 Database Access from a Programming Language Two Approaches 1. Embedding

More information

Conversion Functions

Conversion Functions Conversion Functions Conversion functions convert a value from one datatype to another. Generally, the form of the function names follows the convention datatype TO datatype. The first datatype is the

More information

SQL Introduction Chapter 7, sections 1 & 4. Introduction to SQL. Introduction to SQL. Introduction to SQL

SQL Introduction Chapter 7, sections 1 & 4. Introduction to SQL. Introduction to SQL. Introduction to SQL SQL Introduction Chapter 7, sections 1 & 4 Objectives To understand Oracle s SQL client interface Understand the difference between commands to the interface and SQL language. To understand the Oracle

More information

David L. Fuston, dfuston@vlamis.com Vlamis Software Solutions, Inc., www.vlamis.com

David L. Fuston, dfuston@vlamis.com Vlamis Software Solutions, Inc., www.vlamis.com Data Warehouse and E-Business Intelligence ORACLE S SQL ANALYTIC FUNCTIONS IN 8i AND 9i David L. Fuston, dfuston@vlamis.com, www.vlamis.com INTRODUCTION The SQL language has traditionally provided little

More information

Data Models and Database Management Systems (DBMSs) Dr. Philip Cannata

Data Models and Database Management Systems (DBMSs) Dr. Philip Cannata Data Models and Database Management Systems (DBMSs) Dr. Philip Cannata 1 Data Models in the 1960s, 1970s, and 1980s Hierarchical Network (Graph) Relational Schema (Model) - first 1956 Vern Watts was IMS's

More information

SQL*Plus User s Guide and Reference

SQL*Plus User s Guide and Reference SQL*Plus User s Guide and Reference Release 8.0 Part No. A53717 01 Enabling the Information Age SQL*Plus User s Guide and Reference, Release 8.0 Part No. A53717 01 Copyright 1997 Oracle Corporation All

More information

SQL> SELECT ename, job, sal Salary. 1.4.Will the SELECT statement execute successfully? True/False

SQL> SELECT ename, job, sal Salary. 1.4.Will the SELECT statement execute successfully? True/False BASES DE DATOS Ingeniería Técnica Informática Asignatura Obligatoria: 4.5 + 4.5 créditos (Segundo cuatrimestre) Curso académico 2000/2002 Relación de Ejercicios Prácticos TEMA 1. MANDATO SELECT BÁSICO

More information

Aggregating Data Using Group Functions

Aggregating Data Using Group Functions Aggregating Data Using Group Functions Objectives Capter 5 After completing this lesson, you should be able to do the following: Identify the available group functions Describe the use of group functions

More information

Retrieval: Multiple Tables and Aggregation

Retrieval: Multiple Tables and Aggregation 4487CH08.qxd 11/24/04 10:15 AM Page 191 CHAPTER 8 Retrieval: Multiple Tables and Aggregation This chapter resumes the discussion of the retrieval possibilities of the SQL language. It is a logical continuation

More information

RDBMS Using Oracle. Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture. kamran.munir@gmail.com. Joining Tables

RDBMS Using Oracle. Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture. kamran.munir@gmail.com. Joining Tables RDBMS Using Oracle Lecture Week 7 Introduction to Oracle 9i SQL Last Lecture Joining Tables Multiple Table Queries Simple Joins Complex Joins Cartesian Joins Outer Joins Multi table Joins Other Multiple

More information

DECLARATION SECTION. BODY STATEMENTS... Required

DECLARATION SECTION. BODY STATEMENTS... Required 1 EXCEPTION DECLARATION SECTION Optional BODY STATEMENTS... Required STATEMENTS Optional The above Construction is called PL/SQL BLOCK DATATYPES 2 Binary Integer (-2 **31-1,2**31+1) signed integer fastest

More information

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25)

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? A. INSERT INTO employees

More information

Hacking and Protecting Oracle DB. Slavik Markovich CTO, Sentrigo

Hacking and Protecting Oracle DB. Slavik Markovich CTO, Sentrigo Hacking and Protecting Oracle DB Slavik Markovich CTO, Sentrigo What s This Presentation About? Explore SQL injection in depth Protect your code Finding vulnerable code Real world example What We'll Not

More information

TO_CHAR Function with Dates

TO_CHAR Function with Dates TO_CHAR Function with Dates TO_CHAR(date, 'fmt ) The format model: Must be enclosed in single quotation marks and is case sensitive Can include any valid date format element Has an fm element to remove

More information

Presentation of database relational schema (schema 1) Create Universe step by step

Presentation of database relational schema (schema 1) Create Universe step by step Presentation of database relational schema (schema 1) Create Universe step by step The steps are as follows : 1 Create Oracle schema 2 Connect with administration module 3 Create repository 4 Create universe

More information

Mini User's Guide for SQL*Plus T. J. Teorey

Mini User's Guide for SQL*Plus T. J. Teorey Mini User's Guide for SQL*Plus T. J. Teorey Table of Contents Oracle/logging-in 1 Nested subqueries 5 SQL create table/naming rules 2 Complex functions 6 Update commands 3 Save a query/perm table 6 Select

More information

Oracle/SQL Tutorial 1

Oracle/SQL Tutorial 1 Oracle/SQL Tutorial 1 Michael Gertz Database and Information Systems Group Department of Computer Science University of California, Davis gertz@cs.ucdavis.edu http://www.db.cs.ucdavis.edu This Oracle/SQL

More information

Big Data. Marriage of RDBMS-DWH and Hadoop & Co. Author: Jan Ott Trivadis AG. 2014 Trivadis. Big Data - Marriage of RDBMS-DWH and Hadoop & Co.

Big Data. Marriage of RDBMS-DWH and Hadoop & Co. Author: Jan Ott Trivadis AG. 2014 Trivadis. Big Data - Marriage of RDBMS-DWH and Hadoop & Co. Big Data Marriage of RDBMS-DWH and Hadoop & Co. Author: Jan Ott Trivadis AG BASEL BERN LAUSANNE ZÜRICH DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MÜNCHEN STUTTGART WIEN 1 Mit über 600 IT- und Fachexperten

More information

SQL the natural language for analysis ORACLE WHITE PAPER JUNE 2015

SQL the natural language for analysis ORACLE WHITE PAPER JUNE 2015 SQL the natural language for analysis ORACLE WHITE PAPER JUNE 2015 Contents Overview 1 Introduction 1 Powerful Framework 1 Simplified Optimization 6 Continuous Evolution 8 Standards Based 9 Why Oracle

More information

Relational Algebra. Query Languages Review. Operators. Select (σ), Project (π), Union ( ), Difference (-), Join: Natural (*) and Theta ( )

Relational Algebra. Query Languages Review. Operators. Select (σ), Project (π), Union ( ), Difference (-), Join: Natural (*) and Theta ( ) Query Languages Review Relational Algebra SQL Set operators Union Intersection Difference Cartesian product Relational Algebra Operators Relational operators Selection Projection Join Division Douglas

More information

Date / Time Arithmetic with Oracle

Date / Time Arithmetic with Oracle Date / Time Arithmetic with Oracle If you store date and time information in Oracle, you have two different options for the column's datatype - DATE and TIMESTAMP. DATE is the datatype that we are all

More information

Data Big and Small: How Publisher gain Value out of Data in the Future

Data Big and Small: How Publisher gain Value out of Data in the Future Data Big and Small: How Publisher gain Value out of Data in the Future WS 4: Frank Föge MarkLogic, Oliver Zmorek De Gruyter, Stefan Schwedt Newbooks Solutions Agenda Introduction De Gruyter, Newbooks &

More information

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement Objectives After completing this lesson, you should be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement

More information

Building a Cube in Analysis Services Step by Step and Best Practices

Building a Cube in Analysis Services Step by Step and Best Practices Building a Cube in Analysis Services Step by Step and Best Practices Rhode Island Business Intelligence Group November 15, 2012 Sunil Kadimdiwan InfoTrove Business Intelligence Agenda Data Warehousing

More information

Data Security: Strategy and Tactics for Success

Data Security: Strategy and Tactics for Success Data Security: Strategy and Tactics for Success DatabaseVisions,Inc. Fairfax, Va Oracle Gold Partner Solution Provider Oracle Security Specialized www.databasevisions.com Overview Cloud Computing presents

More information

SQL, PL/SQL FALL Semester 2013

SQL, PL/SQL FALL Semester 2013 SQL, PL/SQL FALL Semester 2013 Rana Umer Aziz MSc.IT (London, UK) Contact No. 0335-919 7775 enquire@oeconsultant.co.uk EDUCATION CONSULTANT Contact No. 0335-919 7775, 0321-515 3403 www.oeconsultant.co.uk

More information

An Oracle White Paper June 2013. Patterns everywhere Find them fast! SQL pattern matching in Oracle Database 12c

An Oracle White Paper June 2013. Patterns everywhere Find them fast! SQL pattern matching in Oracle Database 12c An Oracle White Paper June 2013 Patterns everywhere Find them fast! SQL pattern matching in Oracle Database 12c Executive Overview... 2 Introduction to pattern matching... 3 Patterns everywhere... 3 How

More information

Recursive SQL from a Performance Perspective

Recursive SQL from a Performance Perspective Recursive SQL from a Performance Perspective par Thomas Baumann La Mobilière Réunion du Guide DB2 pour z/os France Vendredi 27 novembre 2009 Tour Euro Plaza, Paris-La Défense Agenda What Is Recursive SQL?

More information

Benefits of Normalisation in a Data Base - Part 1

Benefits of Normalisation in a Data Base - Part 1 Denormalisation (But not hacking it) Denormalisation: Why, What, and How? Rodgers Oracle Performance Tuning Corrigan/Gurry Ch. 5, p69 Stephen Mc Kearney, 2001. 1 Overview Purpose of normalisation Methods

More information

Appendix A Practices and Solutions

Appendix A Practices and Solutions Appendix A Practices and Solutions Table of Contents Practices for Lesson I... 3 Practice I-1: Introduction... 4 Practice Solutions I-1: Introduction... 5 Practices for Lesson 1... 11 Practice 1-1: Retrieving

More information

Procedural Extension to SQL using Triggers. SS Chung

Procedural Extension to SQL using Triggers. SS Chung Procedural Extension to SQL using Triggers SS Chung 1 Content 1 Limitations of Relational Data Model for performing Information Processing 2 Database Triggers in SQL 3 Using Database Triggers for Information

More information

14 Triggers / Embedded SQL

14 Triggers / Embedded SQL 14 Triggers / Embedded SQL COMS20700 Databases Dr. Essam Ghadafi TRIGGERS A trigger is a procedure that is executed automatically whenever a specific event occurs. You can use triggers to enforce constraints

More information

Oracle 11g PL/SQL training

Oracle 11g PL/SQL training Oracle 11g PL/SQL training Course Highlights This course introduces students to PL/SQL and helps them understand the benefits of this powerful programming language. Students learn to create PL/SQL blocks

More information

Using TimesTen between your Application and Oracle. between your Application and Oracle. DOAG Conference 2011

Using TimesTen between your Application and Oracle. between your Application and Oracle. DOAG Conference 2011 DOAG Conference 2011 Using TimesTen between your Application and Oracle Jan Ott, Roland Stirnimann Senior Consultants Trivadis AG BASEL 1 BERN LAUSANNE ZÜRICH DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG

More information

An Oracle White Paper August 2013. Express Mode Loading with SQL*Loader in Oracle Database 12c

An Oracle White Paper August 2013. Express Mode Loading with SQL*Loader in Oracle Database 12c An Oracle White Paper August 2013 Express Mode Loading with SQL*Loader in Oracle Database 12c Introduction... 3 Benefits of Using Express Mode... 3 Overview of CSV Files... 3 CSV files are text files where

More information

2. DECODE Function, CASE Expression

2. DECODE Function, CASE Expression DECODE Function, CASE Expression 2.1 2. DECODE Function, CASE Expression Introduction to DECODE DECODE Examples Contrast with 9i Case Statement CASE Examples CASE Histograms SKILLBUILDERS DECODE Function,

More information

Oracle Database Cloud

Oracle Database Cloud Oracle Database Cloud Shakeeb Rahman Database Cloud Service Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may

More information

Oracle9i Data Guard: SQL Apply Best Practices. An Oracle White Paper September 2003

Oracle9i Data Guard: SQL Apply Best Practices. An Oracle White Paper September 2003 Oracle9i Data Guard: SQL Apply Best Practices An Oracle White Paper September 2003 Oracle9i Data Guard: SQL Apply Best Practices Introduction... 3 SQL Apply Best Practices & Observations At a Glance...

More information

Tune That SQL for Supercharged DB2 Performance! Craig S. Mullins, Corporate Technologist, NEON Enterprise Software, Inc.

Tune That SQL for Supercharged DB2 Performance! Craig S. Mullins, Corporate Technologist, NEON Enterprise Software, Inc. Tune That SQL for Supercharged DB2 Performance! Craig S. Mullins, Corporate Technologist, NEON Enterprise Software, Inc. Table of Contents Overview...................................................................................

More information

MONASH UNIVERSITY. Faculty of Information Technology

MONASH UNIVERSITY. Faculty of Information Technology CSE2132/CSE9002 - Tutorial 1 Database Concept Exercises TOPICS - Database Concepts; Introduction to Oracle Part 1 (To be done in the students own time then discussed in class if necessary.) Hoffer,Prescott

More information

How To Name A Program In Apl/Sql

How To Name A Program In Apl/Sql PL/SQL This section will provide a basic understanding of PL/SQL. This document will briefly cover the main concepts behind PL/SQL and provide brief examples illustrating the important facets of the language.

More information

Benefits of a Multi-Dimensional Model. An Oracle White Paper May 2006

Benefits of a Multi-Dimensional Model. An Oracle White Paper May 2006 Benefits of a Multi-Dimensional Model An Oracle White Paper May 2006 Benefits of a Multi-Dimensional Model Executive Overview... 3 Introduction... 4 Multidimensional structures... 5 Overview... 5 Modeling

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Test: Final Exam - Database Programming with SQL Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 8 Lesson 1 1. You are creating the EMPLOYEES

More information

SQL interview questions and answers

SQL interview questions and answers SQL interview questions and answers What is SQL and where does it come from? Structured Query Language (SQL) is a language that provides an interface to relational database systems. SQL was developed by

More information

Access to Relational Databases Using SAS. Frederick Pratter, Destiny Corp.

Access to Relational Databases Using SAS. Frederick Pratter, Destiny Corp. Paper TF-21 Access to Relational Databases Using SAS ABSTRACT Frederick Pratter, Destiny Corp. SAS software currently provides many of the features of a database management system, including database views

More information

Chapter 2: Security in DB2

Chapter 2: Security in DB2 2. Security in DB2 2-1 DBA Certification Course (Summer 2008) Chapter 2: Security in DB2 Authentication DB2 Authorities Privileges Label-Based Access Control 2. Security in DB2 2-2 Objectives After completing

More information

Data Domain Profiling and Data Masking for Hadoop

Data Domain Profiling and Data Masking for Hadoop Data Domain Profiling and Data Masking for Hadoop 1993-2015 Informatica LLC. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording or

More information

Monitoring and Diagnosing Oracle RAC Performance with Oracle Enterprise Manager. Kai Yu, Orlando Gallegos Dell Oracle Solutions Engineering

Monitoring and Diagnosing Oracle RAC Performance with Oracle Enterprise Manager. Kai Yu, Orlando Gallegos Dell Oracle Solutions Engineering Monitoring and Diagnosing Oracle RAC Performance with Oracle Enterprise Manager Kai Yu, Orlando Gallegos Dell Oracle Solutions Engineering About Author Kai Yu Senior System Engineer, Dell Oracle Solutions

More information

UNIVERSE DESIGN BEST PRACTICES. Roxanne Pittman, InfoSol May 8, 2014

UNIVERSE DESIGN BEST PRACTICES. Roxanne Pittman, InfoSol May 8, 2014 UNIVERSE DESIGN BEST PRACTICES Roxanne Pittman, InfoSol May 8, 2014 SEVEN PRINCIPLES OF UNIVERSAL DESIGN BY THE CENTER FOR UNIVERSAL DESIGN (CUD) NORTH CAROLINA STATE UNIVERSITY 1. Equitable use. The design

More information

Handling Exceptions. Schedule: Timing Topic. 45 minutes Lecture 20 minutes Practice 65 minutes Total

Handling Exceptions. Schedule: Timing Topic. 45 minutes Lecture 20 minutes Practice 65 minutes Total 23 Handling Exceptions Copyright Oracle Corporation, 1999. All rights reserved. Schedule: Timing Topic 45 minutes Lecture 20 minutes Practice 65 minutes Total Objectives After completing this lesson, you

More information

Maximizing Materialized Views

Maximizing Materialized Views Maximizing Materialized Views John Jay King King Training Resources john@kingtraining.com Download this paper and code examples from: http://www.kingtraining.com 1 Session Objectives Learn how to create

More information

Monitoring and Diagnosing Oracle RAC Performance with Oracle Enterprise Manager

Monitoring and Diagnosing Oracle RAC Performance with Oracle Enterprise Manager Monitoring and Diagnosing Oracle RAC Performance with Oracle Enterprise Manager Kai Yu, Orlando Gallegos Dell Oracle Solutions Engineering Oracle OpenWorld 2010, Session S316263 3:00-4:00pm, Thursday 23-Sep-2010

More information

Unit 3. Retrieving Data from Multiple Tables

Unit 3. Retrieving Data from Multiple Tables Unit 3. Retrieving Data from Multiple Tables What This Unit Is About How to retrieve columns from more than one table or view. What You Should Be Able to Do Retrieve data from more than one table or view.

More information

OLH: Oracle Loader for Hadoop OSCH: Oracle SQL Connector for Hadoop Distributed File System (HDFS)

OLH: Oracle Loader for Hadoop OSCH: Oracle SQL Connector for Hadoop Distributed File System (HDFS) Use Data from a Hadoop Cluster with Oracle Database Hands-On Lab Lab Structure Acronyms: OLH: Oracle Loader for Hadoop OSCH: Oracle SQL Connector for Hadoop Distributed File System (HDFS) All files are

More information

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama

Lab # 5. Retreiving Data from Multiple Tables. Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 5 Retreiving Data from Multiple Tables Eng. Alaa O Shama November, 2015 Objectives:

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY GUJARAT TECHNOLOGICAL UNIVERSITY COMPUTER ENGINEERING (07) / INFORMATION TECHNOLOGY (16) / INFORMATION & COMMUNICATION TECHNOLOGY (32) DATABASE MANAGEMENT SYSTEMS SUBJECT CODE: 2130703 B.E. 3 rd Semester

More information

Handling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1

Handling Exceptions. Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Handling Exceptions Copyright 2006, Oracle. All rights reserved. Oracle Database 10g: PL/SQL Fundamentals 8-1 Objectives After completing this lesson, you should be able to do the following: Define PL/SQL

More information

Extended Principle of Orthogonal Database Design

Extended Principle of Orthogonal Database Design Proceedings of the 5th WSEAS Int. Conf. on Artificial Intelligence, Knowledge Engineering and Data Bases, Madrid, Spain, February 5-7, 006 (pp360-365) Extended Principle of Orthogonal Database Design ERKI

More information

Objectives. Oracle SQL and SQL*PLus. Database Objects. What is a Sequence?

Objectives. Oracle SQL and SQL*PLus. Database Objects. What is a Sequence? Oracle SQL and SQL*PLus Lesson 12: Other Database Objects Objectives After completing this lesson, you should be able to do the following: Describe some database objects and their uses Create, maintain,

More information

Oracle Database Gateways. An Oracle White Paper July 2007

Oracle Database Gateways. An Oracle White Paper July 2007 Oracle Database Gateways An Oracle White Paper July 2007 Oracle Database Gateways Introduction... 3 Connecting Disparate systems... 3 SQL Translations... 4 Data Dictionary Translations... 4 Datatype Translations...

More information

An Oracle White Paper June 2014. RESTful Web Services for the Oracle Database Cloud - Multitenant Edition

An Oracle White Paper June 2014. RESTful Web Services for the Oracle Database Cloud - Multitenant Edition An Oracle White Paper June 2014 RESTful Web Services for the Oracle Database Cloud - Multitenant Edition 1 Table of Contents Introduction to RESTful Web Services... 3 Architecture of Oracle Database Cloud

More information

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Test: Final Exam - Database Programming with SQL Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 8 Lesson 1 1. Which SQL statement below will

More information

SQL Injection in web applications

SQL Injection in web applications SQL Injection in web applications February 2013 Slavik Markovich VP, CTO, Database Security McAfee About Me Co-Founder & CTO of Sentrigo (now McAfee Database Security) Specialties: Databases, security,

More information

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 12c: Introduction to SQL Ed 1.1 Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,

More information

create.java Printed by Jerzy Szymanski

create.java Printed by Jerzy Szymanski create.java Mar 16, 07 1:08 Page 1/1 class create ("jdbc:oracle:thin:zsi_jerzy/haslo@sla b2:1521:lab2"); "); ; ResultSet rset = stmt.executequery("create TABLE emp2 AS SELECT * FROM emp catch (SQLException

More information

SQL Optimization & Access Paths: What s Old & New Part 1

SQL Optimization & Access Paths: What s Old & New Part 1 SQL Optimization & Access Paths: What s Old & New Part 1 David Simpson Themis Inc. dsimpson@themisinc.com 2008 Themis, Inc. All rights reserved. David Simpson is currently a Senior Technical Advisor at

More information

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL Chapter 9 Joining Data from Multiple Tables Oracle 10g: SQL Objectives Identify a Cartesian join Create an equality join using the WHERE clause Create an equality join using the JOIN keyword Create a non-equality

More information

Firebird 3 Windowing Functions

Firebird 3 Windowing Functions Author: Philippe Makowski IBPhoenix Email: pmakowski@ibphoenix Licence: Public Documentation License Date: 2011-11-22 What are Windowing Functions? Similar to classical aggregates but does more! Provides

More information

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL Oracle Database: Program with PL/SQL Duration: 5 Days What you will learn This Oracle Database: Program with PL/SQL training starts with an introduction to PL/SQL and then explores the benefits of this

More information

A basic create statement for a simple student table would look like the following.

A basic create statement for a simple student table would look like the following. Creating Tables A basic create statement for a simple student table would look like the following. create table Student (SID varchar(10), FirstName varchar(30), LastName varchar(30), EmailAddress varchar(30));

More information

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs.

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs. Phases of database design Application requirements Conceptual design Database Management Systems Conceptual schema Logical design ER or UML Physical Design Relational tables Logical schema Physical design

More information

Bruce Momjian June, 2008. Postgres Plus Technical Overview

Bruce Momjian June, 2008. Postgres Plus Technical Overview Bruce Momjian June, 2008 Postgres Plus Technical Overview PostgreSQL Heritage Independent & Thriving Development Community 10 committers and ~200 reviewers 1,500 contributors and 10,000+ members 2,000,000+

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database technology.

More information

Oracle Database: Develop PL/SQL Program Units

Oracle Database: Develop PL/SQL Program Units Oracle University Contact Us: 1.800.529.0165 Oracle Database: Develop PL/SQL Program Units Duration: 3 Days What you will learn This Oracle Database: Develop PL/SQL Program Units course is designed for

More information

UnionSys Technologies Securing Stored Data Using Transparent Data Encryption And Disaster Recovery Solution

UnionSys Technologies Securing Stored Data Using Transparent Data Encryption And Disaster Recovery Solution UnionSys Technologies Securing Stored Data Using Transparent Data Encryption And Disaster Recovery Solution UnionSys Technologies Transparent Data Encryption 1 CONTENTS Introduction... 3 Purpose... 3 Scope...

More information

Automated ETL Testing with Py.Test. Kevin A. Smith Senior QA Automation Engineer Cambia Health Solutions

Automated ETL Testing with Py.Test. Kevin A. Smith Senior QA Automation Engineer Cambia Health Solutions Automated ETL Testing with Py.Test Kevin A. Smith Senior QA Automation Engineer Cambia Health Solutions 2 Agenda Overview Testing Data Quality Design for Automation & Testability Python and Py.Test Examples

More information

Oracle PL/SQL Best Practices

Oracle PL/SQL Best Practices Achieving PL/SQL Excellence Oracle PL/SQL Best Practices Steven Feuerstein Me - www.stevenfeuerstein.com PL/Solutions - www.plsolutions.com RevealNet - www.revealnet.com 7/5/99 Copyright 1999 Steven Feuerstein

More information

Introduction to the Oracle DBMS

Introduction to the Oracle DBMS Introduction to the Oracle DBMS Kristian Torp Department of Computer Science Aalborg University www.cs.aau.dk/ torp torp@cs.aau.dk December 2, 2011 daisy.aau.dk Kristian Torp (Aalborg University) Introduction

More information

The Power of DECODE()

The Power of DECODE() The Power of DECODE() Doug Burns Note - this document discusses the use of the DECODE function to develop more efficient SQL queries. However, if you're using Oracle 8.1.6 or greater, you should really

More information

Advanced SQL. Jim Mason. www.ebt-now.com Web solutions for iseries engineer, build, deploy, support, train 508-728-4353. jemason@ebt-now.

Advanced SQL. Jim Mason. www.ebt-now.com Web solutions for iseries engineer, build, deploy, support, train 508-728-4353. jemason@ebt-now. Advanced SQL Jim Mason jemason@ebt-now.com www.ebt-now.com Web solutions for iseries engineer, build, deploy, support, train 508-728-4353 What We ll Cover SQL and Database environments Managing Database

More information

PassTest. Bessere Qualität, bessere Dienstleistungen!

PassTest. Bessere Qualität, bessere Dienstleistungen! PassTest Bessere Qualität, bessere Dienstleistungen! Q&A Exam : 070-463 Title : Implementing a Data Warehouse with Microsoft SQL Server 2012 Version : DEMO 1 / 11 1.You are developing a project that contains

More information

Training Guide. PL/SQL for Beginners. Workbook

Training Guide. PL/SQL for Beginners. Workbook An Training Guide PL/SQL for Beginners Workbook Workbook This workbook should be worked through with the associated Training Guide, PL/SQL for Beginners. Each section of the workbook corresponds to a section

More information

VARRAY AND NESTED TABLE

VARRAY AND NESTED TABLE Oracle For Beginners Page : 1 Chapter 23 VARRAY AND NESTED TABLE What is a collection? What is a VARRAY? Using VARRAY Nested Table Using DML commands with Nested Table Collection methods What is a collection?

More information

Database programming 20/08/2015. DBprog news. Outline. Motivation for DB programming. Using SQL queries in a program. Using SQL queries in a program

Database programming 20/08/2015. DBprog news. Outline. Motivation for DB programming. Using SQL queries in a program. Using SQL queries in a program DBprog news Database programming http://eric.univ-lyon2.fr/~jdarmont/?page_id=451 M1 Informatique Year 2015-2016 Jérôme Darmont http://eric.univ-lyon2.fr/~jdarmont/ http://eric.univ-lyon2.fr/~jdarmont/?feed=rss2

More information

D B M G Data Base and Data Mining Group of Politecnico di Torino

D B M G Data Base and Data Mining Group of Politecnico di Torino Politecnico di Torino Database Management System Oracle Hints Data Base and Data Mining Group of Politecnico di Torino Tania Cerquitelli Computer Engineering, 2014-2015, slides by Tania Cerquitelli and

More information

Database Design and Database Programming with SQL - 5 Day In Class Event Day 1 Activity Start Time Length

Database Design and Database Programming with SQL - 5 Day In Class Event Day 1 Activity Start Time Length Database Design and Database Programming with SQL - 5 Day In Class Event Day 1 Welcome & Introductions 9:00 AM 20 Lecture 9:20 AM 40 Practice 10:00 AM 20 Lecture 10:20 AM 40 Practice 11:15 AM 30 Lecture

More information

Improving SQL efficiency using CASE

Improving SQL efficiency using CASE Improving SQL efficiency using CASE Some time ago I wrote The Power of Decode - a paper on using the DECODE function to improve report performance. I was aware at the time that DECODE was being replaced

More information

SQL Tuning Proven Methodologies

SQL Tuning Proven Methodologies SQL Tuning Proven Methodologies V.Hariharaputhran V.Hariharaputhran o Twelve years in Oracle Development / DBA / Big Data / Cloud Technologies o All India Oracle Users Group (AIOUG) Evangelist o Passion

More information

Upcoming: Oracle Database 12.1 Support Update for Linux on System z

Upcoming: Oracle Database 12.1 Support Update for Linux on System z Upcoming: Oracle Database 12.1 Support Update for Linux on System z International zseries Oracle SIG Webcast Series The International zseries Oracle Special Interest Group (SIG) is an organization of companies

More information

Oracle Database: Program with PL/SQL

Oracle Database: Program with PL/SQL Oracle University Contact Us: 1.800.529.0165 Oracle Database: Program with PL/SQL Duration: 5 Days What you will learn View a newer version of this course /a/b/p/p/b/pulli/lili/lili/lili/lili/lili/lili/lili/lili/lili/lili/lili/li/ul/b/p/p/b/p/a/a/p/

More information

Duration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts

Duration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts D80186GC10 Oracle Database: Program with Summary Duration Vendor Audience 5 Days Oracle Developers, Technical Consultants, Database Administrators and System Analysts Level Professional Technology Oracle

More information