Overview of DB2 10 and DB2 11 SQL Enhancements. Christopher J. Crone IBM

Size: px
Start display at page:

Download "Overview of DB2 10 and DB2 11 SQL Enhancements. Christopher J. Crone IBM"

Transcription

1 Overview of DB2 10 and DB2 11 SQL Enhancements Christopher J. Crone IBM

2 2 Agenda Overview of DB2 Family SQL Functionality Review of DB2 10 SQL Enhancements Introduction to DB2 11 Enhancements Summary of recent enhancements

3 DB2 SQL DB2 10 for z/os and DB Linux, Unix & Windows z (not exhaustive, some features may be missing) Multi-row INSERT, FETCH & multi-row cursor UPDATE, dynamic scrollable cursors, GET DIAGNOSTICS, join across encoding schemes, IS NOT DISTINCT FROM, VARBINARY, FETCH CONTINUE, SELECT from MERGE, routine versions, time zone support 3 c o m m o n l u w Inner and outer joins, table expressions, subqueries, GROUP BY, complex correlation, global temporary tables, CASE, 100+ built-in functions including SQL/XML, limited fetch, insensitive scrollable cursors, UNION everywhere, MIN/MAX single index, self-referencing updates with subqueries, sort avoidance for ORDER BY, row expressions, CALL from trigger, statement isolation, range partitioning, 2M statement length, GROUP BY expression, sequences, scalar fullselect, materialized query tables, common table expressions, recursive SQL, CURRENT PACKAGE PATH, VOLATILE tables, star join, sparse index, qualified column names, multiple DISTINCT clauses, ON COMMIT DROP, transparent ROWID column, FOR READ ONLY, KEEP UPDATE LOCKS, SET CURRENT SCHEMA, client special registers, long SQL object names, SELECT FROM INSERT, UPDATE or DELETE, INSTEAD OF trigger, SQL PL in routines, file reference variables, XML, FETCH FIRST & ORDER BY in subselect/fullselect, EXCEPT, INTERSECT, MERGE, BIGINT, caseless comparisons, not logged tables, text search functions, spatial, data compression, DECFLOAT, optimistic locking, ROLE, TRUNCATE, index & XML compression, created temps, inline LOB, administrative privileges, implicit cast, datetime enhancements, currently committed, moving sum & average, index include columns, row and column access controls, time travel query, trusted contexts Updateable UNION in views, GROUPING SETS, ROLLUP, CUBE, more built-in functions, SET CURRENT ISOLATION, MDC, XQuery, XML enhancements, global variables, temp table compression, user-defined array types 3

4 DB2 SQL DB2 11 for z/os and DB Linux, Unix & Windows z c o m m o n l u w 4 (not exhaustive, some features may be missing) Multi-row INSERT, FETCH & multi-row cursor UPDATE, dynamic scrollable cursors, GET DIAGNOSTICS, join across encoding schemes, IS NOT DISTINCT FROM, VARBINARY, FETCH CONTINUE, SELECT FROM MERGE, routine versions, time zone support, transparent archive query, accelerated tables Inner and outer joins, table expressions, subqueries, GROUP BY, complex correlation, global temporary tables, CASE, 100+ built-in functions including SQL/XML, limited fetch, insensitive scrollable cursors, UNION everywhere, MIN/MAX single index, self-referencing updates with subqueries, sort avoidance for ORDER BY, row expressions, CALL from trigger, statement isolation, range partitioning, 2M statement length, GROUP BY expression, sequences, scalar fullselect, materialized query tables, common table expressions, recursive SQL, CURRENT PACKAGE PATH, VOLATILE tables, star join, sparse index, qualified column names, multiple DISTINCT clauses, ON COMMIT DROP, transparent ROWID column, FOR READ ONLY, KEEP UPDATE LOCKS, SET CURRENT SCHEMA, client special registers, long SQL object names, SELECT FROM INSERT, UPDATE or DELETE, INSTEAD OF trigger, SQL PL in routines, file reference variables, XML, FETCH FIRST & ORDER BY in subselect/fullselect, EXCEPT, INTERSECT, MERGE, BIGINT, caseless comparisons, not logged tables, text search functions, spatial, data compression, DECFLOAT, optimistic locking, ROLE, TRUNCATE, index & XML compression, created temps, inline LOB, administrative privileges, implicit cast, datetime enhancements, currently committed, moving sum & average, index include columns, row and column access controls, time travel query, trusted contexts, global variables, GROUPING SETS, ROLLUP, CUBE, DROP COLUMN, user-defined array types, XQuery Updateable UNION in views, more built-in functions, SET CURRENT ISOLATION, MDC, XML enhancements, additional user-defined types (row and cursor), MODULEs, column organized tables (BLU Acceleration), parameter defaults 4

5 Review of DB2 10 SQL Enhancements 5

6 OLAP Specification New in DB2 10 Moving Sum, Moving Average 6

7 OLAP Specification (Window Functions???) 7 RANK/DENSE_RANK ROW_NUMBER

8 Example: RANK 8 SELECT EMPNO, LASTNAME, SALARY+BONUS AS TOTAL_SALARY, RANK() OVER(ORDER BY SALARY+BONUS DESC) AS RANK_SALARY FROM DSN8A10.EMP WHERE SALARY+BONUS > ORDER BY RANK_SALARY; EMPNO LASTNAME TOTAL_SALARY RANK_SALARY _ HAAS _ HEMMINGER _ LUCCHESI _ THOMPSON _ GEYER _ KWAN _ PULASKI _ STERN _ LUTZ _ JOHN _ HENDERSON

9 Example: DENSE_RANK 9 SELECT EMPNO, LASTNAME, SALARY+BONUS AS TOTAL_SALARY, DENSE_RANK() OVER(ORDER BY SALARY+BONUS DESC) AS RANK_SALARY FROM DSN8A10.EMP WHERE SALARY+BONUS > ORDER BY RANK_SALARY; EMPNO LASTNAME TOTAL_SALARY RANK_SALARY _ HAAS _ HEMMINGER _ LUCCHESI _ THOMPSON _ GEYER _ KWAN _ PULASKI _ STERN _ LUTZ _ JOHN _ HENDERSON

10 Example: ROW_NUMBER 10 SELECT EMPNO, LASTNAME, SALARY+BONUS AS TOTAL_SALARY, ROW_NUMBER() OVER(ORDER BY SALARY+BONUS DESC) AS RANK_SALARY FROM DSN8A10.EMP WHERE SALARY+BONUS > ORDER BY RANK_SALARY; EMPNO LASTNAME TOTAL_SALARY RANK_SALARY _ HAAS _ HEMMINGER _ LUCCHESI _ THOMPSON _ GEYER _ KWAN _ PULASKI _ STERN _ LUTZ _ JOHN _ HENDERSON

11 11 DB OLAP Specification defined using a window. A window may specify three components (each is optional). Partitioning PARTITION BY CLAUSE Ordering ORDER BY clause Aggregation group ROWS/RANGE

12 12 Compute the average sales over the current month and the preceding two months for each territory and month. SELECT Territory, Month, Sales, AVG(Sales) OVER(PARTITION BY Territory ORDER BY Month ROWS 2 PRECEDING) AS Moving_Average FROM Sales_History;

13 13 Territory Month Sales Moving_Average East East East East East West West West West West

14 Compute the cumulative sum of sales in each territory, ordered by month. 14 SELECT Territory, Month, Sales, SUM(Sales) OVER(PARTITION BY Territory ORDER BY Month ASC ROWS UNBOUNDED PRECEDING) AS Cumulative_Sum FROM Sales_History; 14

15 15 Territory Month Sales Cumulative_Sum East East East East East West West West West West

16 16 Timestamp Enhancements 16

17 Timestamp Enhancements (6) WITHOUT TIME ZONE-+ >---+--TIMESTAMP >< +--(integer) WITH TIME ZONE Number of fractional digits in a timestamp extended Range supported in V10 0 to 12 digits (default is 6) Other capabilities like timestamp duration and CURRENT TIMESTAMP extended to support new precision capability SQL statements support ODBC and JDBC string representation of a timestamp as an input value only The ODBC and JDBC string representation of a timestamp has the form yyyy-mm-dd-hh:mm:ss.nnnnnn Example representation of TSwTZ: :00' :00' :00'

18 18 TIMESTAMP WITH TIMEZONE OVERVIEW New data type TIMESTAMP WITH TIME ZONE New special registers SESSION TIME ZONE CURRENT TIMESTAMP (p) WITH TIME ZONE New system parameter implicit time zone IMPLICIT_TIMEZONE TIMESTAMP WITH TIME ZONE constant TIMESTAMP string-constant A new Scalar function TIMESTAMP_TZ A new time-zone-specific-expression <timestamp expression> AT TIME ZONE <time zone expression> Existing functions takes new parameter or new data type

19 SELECT result (new data type) 19 SELECT returns external representation in stored time zone: Local timestamp (UTC + stored time zone) Time zone (stored time zone) Example: CREATE TABLE CALLCENTER (CALL_TIME TIMESTAMP WITH TIME ZONE, CALLER_ID INTEGER NOT NULL); INSERT INTO CALLCENTER VALUES(' :00, 1); INSERT INTO CALLCENTER VALUES(' :00, 2); SELECT * FROM CALLCENTER; Result: CALL_TIME CALLER_ID : :00 2

20 SPECIAL REGISTERS 20 CURRENT SESSION TIME ZONE specifies the time zone of the application process. VARCHAR(128), Format: 'tzh:tzm Default: Equivalent time zone as CURRENT TIME ZONE (internal convert) CURRENT TIMESTAMP(p) WITH TIME ZONE returns server timestamp with time zone SET SESSION TIME ZONE statement assigns a value to the special register. Example: SET SESSION TIME ZONE = -8:00'; SELECT SESSION TIME ZONE FROM SYSIBM.SYSDUMMY1; will return -08:00 SELECT CURRENT TIMESTAMP, CURRENT TIME ZONE, CURRENT TIMESTAMP WITH TIME ZONE FROM SYSIBM.SYSDUMMY1; returns CURRENT TIMESTAMP CURRENT TIME ZONE CURRENT TIMESTAMP WITH TIME ZONE :00 20

21 21 New system parameter implicit time zone A new DB2 DSNHDECP parameter IMPLICIT_TIMEZONE is provided to indicate the default time zone to associate with the TIMESTAMP WITHOUT TIME ZONE values: CURRENT: use CURRENT TIMEZONE This is default SESSION: use SESSION TIMEZONE Explicitly specify a time zone value, i.e. IMPLICIT_TIMEZONE = -00:00 Example: SET SESSION TIME ZONE = -4:00'; INSERT INTO CALLCENTER VALUES(' :00, 1); INSERT INTO CALLCENTER VALUES(' , 2); SELECT * FROM CALLCENTER WHERE CALL_TIME = ' ; Result: CALL_TIME CALLER_ID :00 2

22 Comparison (new data type) Two TIMESTAMP WITH TIME ZONE values are considered to be the same if they represent the same instant of UTC format, regardless of the time zone offsets that are stored in the data. The predicate can be sargable and indexable. Example: CREATE TABLE CALLCTR (CALL_TIME TIMESTAMP WITH TIME ZONE, CALLER_ID INTEGER NOT NULL); INSERT INTO CALLCTR VALUES(' :00, 1); INSERT INTO CALLCTR VALUES(' :00, 2); SELECT * FROM CALLCTR WHERE CALL_TIME = ' :00 ; Result: CALL_TIME CALLER_ID : :

23 23 TIMESTAMP_TZ Scalar function TIMESTAMP_TZ >>-TIMESTAMP_TZ--(--expression )--->< '-,--expression-2-' Returns a TIMESTAMP WITH TIME ZONE value from the input arguments. Example: TIMESTAMP_TZ(TIMESTAMP , -7:00 ) returns TIMESTAMP WITH TIME ZONE :00 TIMESTAMP_TZ( , -6:00, 3) returns TIMESTAMP WITH TIME ZONE :00 TIMESTAMP_TZ( ) returns TIMESTAMP WITH TIME ZONE :00 (if implicit time zone is set as -7:00)

24 24 Extract Scalar function EXTRACT TIMEZONE_HOUR or TIMEZONE_MINUTE (existing function with new options) >>--EXTRACT (--+-HOUR FROM -+-date-expression )< -MINUTE time-expression SECOND timestamp-expression- -TIMEZONE_HOUR--- '-TIMEZONE_MINUTE-' Returns time zone hour or time zone minute portion of timestamp-with-time zone expression. If the datetime argument includes a time zone, the result is determined from the UTC representation of the timestamp-with-time zone-expression value. Example: Assume that host variable PRSTSZ contains ' :30 EXTRACT(HOUR FROM :PRSTSZ) returns 4 (in UTC) EXTRACT(TIMEZONE_HOUR FROM :PRSTSZ) returns -8 EXTRACT(TIMEZONE_MINUTE FROM :PRSTSZ) return -30

25 25 Implicit Casting 25

26 26 Implicit Casting When two operands of an operation such as assignment or comparison have incompatible data types (numeric data from/to character or string data), DB2 will implicitly convert one operand to a data type that is compatible with the other. This extends the compatibility rules so that character or graphic string data types and numeric data types become compatible

27 27 Implicit Cast from Numeric Types to String Types Source Data Type SMALLINT INTEGER BIGINT NUMERIC/DECIMAL REAL FLOAT DOUBLE DECFLOAT Target Data Type VARCHAR(6) VARCHAR(11) VARCHAR(20) VARCHAR(precision+2) VARCHAR(24) VARCHAR(24) VARCHAR(24) VARCHAR(42)

28 28 Implicit Cast from String Types to Numeric Types Source Data Type CHAR VARCHAR GRAPHIC VARGRAPHIC CHAR/VARCHAR FOR BIT DATA BINARY VARBINARY BLOB CLOB DBCLOB Target Data Type DECFLOAT(34) DECFLOAT(34) DECFLOAT(34) DECFLOAT(34) N/A N/A N/A N/A N/A N/A

29 29 ROW and COLUMN ACCESS CONTROL 29

30 30 New Terminology Row Permission A row permission is a database object that expresses a row access control rule for a specific table. A row permission is a rule in the form of an SQL search condition that describes to which rows users have access. Row permissions are applied after the checking of table privileges (e.g. SELECT, INSERT) Column Mask A column mask is a database object that expresses a column access control rule for a specific column in a table. A column mask contains the rule in the form of an SQL CASE expression that describes to what masked value returned for the column value users have access. Column masks are applied after the checking of table privileges (e.g. SELECT, UPDATE)

31 31 Row Permission Row filtering Who can see what rows Applicable to SELECT, INSERT, UPDATE, DELETE, MERGE New object CREATE PERMISSION permission-name ON table-name FOR ROWS WHERE search-condition ENFORCED FOR ALL ACCESS ENABLE; Created by SECADM authority only Job card,user=secadm, Row permission definition can reference any objects except target table

32 32 Column Mask Column masking Who can see what value for an output column Applicable to the final result table New object CREATE MASK mask-name ON table-name FOR COLUMN column-name RETURN CASE-expression ENABLE; Created by SECADM authority only Job card,user=secadm, Column mask definition can reference any objects except target table

33 33 Activate Row and Column Access Control Activated by SECADM authority only Job card,user=secadm, Invalidate packages and cached statements Row permissions and column masks become effective in DML All row permissions are merged to filter out rows Multiple row permissions are connected with OR All column masks are applied to mask output columns Generate default row permission 1 = 0 if activated for row ALTER TABLE table-name ACTIVATE ROW ACCESS CONTROL ACTIVATE COLUMN ACCESS CONTROL; ALTER TABLE table-name ACTIVATE ROW ACCESS CONTROL;

34 34 Deactivate Row and Column Access Control Deactivated by SECADM authority only Job card,user=secadm, Invalidate packages and cached statements Row permissions and column masks become ineffective in DML Remove default row permission 1 = 0 if deactivated for row Open all access to the table ALTER TABLE table-name DEACTIVATE ROW ACCESS CONTROL DEACTIVATE COLUMN ACCESS CONTROL; ALTER TABLE table-name DEACTIVATE ROW ACCESS CONTROL;

35 35 Use case scenario CUSTOMER table contains information about the bank customers INTERNAL_INFO table contains information about bank employees The bank has a security policy for access to customer information Table: CUSTOMER Account Name Income Branch Alice 22,000 A Bob 71,000 B Carl 123,000 B David 172,000 C

36 36 Use Case Scenario (Cont d) ROW PERMISSION FOR TELLERS CREATE PERMISSION TELLER_ROW_ACCESS ON CUSTOMER FOR ROWS WHERE VERIFY_ROLE_FOR_USER (USER, TELLER ) = 1 AND BRANCH = (SELECT HOME_BRANCH FROM INTERNAL_INFO WHERE EMP_ID = USER) ENFORCED FOR ALL ACCESS ENABLE ROW PERMISSION FOR CSR and TELEMARKETER CREATE PERMISSION CSR_ROW_ACCESS ON CUSTOMER FOR ROWS WHERE VERIFY_ROLE_FOR_USER (USER, CSR ) = 1 OR VERIFY_ROLE_FOR_USER (USER, TELEMARKETER ) = 1 ENFORCED FOR ALL ACCESS ENABLE

37 37 Use Case Scenario (Cont d) COLUMN MASK FOR ACCOUNT NUMBER CREATE MASK ACCOUNT_COL_MASK ON CUSTOMER FOR COLUMN ACCOUNT RETURN CASE WHEN (VERIFY_ROLE_FOR_USER (USER, TELEMARKETER ) = 1) THEN 'xxxx-xxxx-xxxx- SUBSTR(ACCOUNT,13,4) ELSE ACCOUNT END ENABLE ACTIVATE ROW AND COLUMN LEVEL ACCESS CONTROL ALTER TABLE CUSTOMER ACTIVATE ROW LEVEL ACCESS CONTROL ACTIVATE COLUMN LEVEL ACCESS CONTROL

38 38 Use Case Scenario Cont d Teller Amy issues the following query SELECT ACCOUNT, NAME, BRANCH FROM CUSTOMER Account Name Income Branch Bob 71,000 B Carl 123,000 B Telemarketer Pat issues the following same query Account Name Income Branch XXXX-XXXX-XXXX-4444 Alice 22,000 A XXXX-XXXX-XXXX-5555 Bob 71,000 B XXXX-XXXX-XXXX-6666 Carl 123,000 B XXXX-XXXX-XXXX-7777 David 172,000 C

39 39 Miscellaneous SQL Enhancements 39

40 40 SQL Syntax Compatibility items Synonyms UNIQUE (synonym for DISTINCT) MINUS (synonym for EXCEPT) seqname.nextval synonym for NEXT VAL FOR seqname seqname.currval synonym for PREVIOUS VALUE FOR seqname FROM clause on DELETE is optional CROSS JOIN Cartesian Product - inner join with WHERE 1 = 1 predicate Cursor with Return to client

41 41 Additional Built In Function Capability TO_CHAR (*extended function*) - see VARCHAR_FORMAT VARCHAR_FORMAT (*extended function*) Additional Format Models Format string is optional Additional datatype support BITxxx 5 bit manipulation functions BITAND, BITANDNOT, BITOR, BITXOR, BITNOT DECODE Transform into CASE expression TO_NUMBER Synonym for DECFLOAT_FORMAT and additional function NVL - > Synonym for COALESCE

42 Introduction to DB2 11 Enhancements 42

43 SQL PL Array Data Type 43

44 Review of SQL Procedures What is an SQL Stored Procedure? A stored procedure that contains only SQL statements May use SQL control statements to write the logic part of the program (e.g. WHILE, IF, GOTO, REPEAT, etc.) SQL Procedural Language or SQL PL 44 Two types of SQL Stored Procedures External SQL Procedures (from V5 on) - Generated C program which runs in a WLM environment Native SQL Procedures (from DB2 9 on) - The SQL procedure logic runs in the DBM1 address space

45 Native SQL Procedure Processing 45 z/os Appl pgm CALL SP1 DB2 DBM1 DDF Appl pgm SP1 SQL PL native logic SQL SQL CALL SP1 EDM pool DB2 directory SP1 SQL PL native logic SQL SQL *native SQL procedures do not run IN the WLM address space but are still running UNDER the WLM

46 Array Data Type Overview DB2 for z/os introduces support for Arrays inside SQL Routines (UDFs or Procedures). Prior to DB2 11, users might have utilized the following mechanisms to pass data to/from Routines: DECLARED GLOBAL TEMPORARY TABLE, Concatenated Strings, Long lists of parameters, or The Array Data Type consists of an ordered set of elements having the same data type (length, precision, scale, CCSID as appropriate) Two Types of Arrays are Supported: Ordinary Arrays Have a maximum cardinality (2 Billion) The data type of the index value is INTEGER Associative Arrays Do not have a defined upper bound on the number of elements The data type of the index values can be an INTEGER or character string (not a LOB) 46

47 Creating an Array Type 47 CREATE Ordinary and Associative arrays via CREATE TYPE statement All types except XML If data-type2 is specified, then array is an Associative Array -- ordinary array with integer value & integer index CREATE TYPE OrdIntArray AS INTEGER ARRAY[100]; -- associative array with integer value & integer index CREATE TYPE AssocIntArray AS INTEGER ARRAY[INT]; -- associative array with integer value & varchar index CREATE TYPE AssocIntArrayVarIdx AS INTEGER ARRAY[VARCHAR(13)];

48 Creating a Native SQL Routine with Array Arguments 48 CREATE FUNCTION (SQL scalar) Array elements may only be sent in as an argument to a function (whole) Arrays may be passed in as an argument or a result of a function CREATE PROCEDURE (SQL native) Array elements may only be sent in as an IN parm to a procedure (whole) Arrays may be passed in as IN, OUT, or INOUT parms for a procedure -- create a UDF that accepts and returns an ordinary array CREATE FUNCTION UDF1 (P1 OrdIntArray, P2 INTEGER) RETURNS OrdIntArray BEGIN END; -- ordinary array with integer value & integer index CREATE TYPE OrdIntArray AS INTEGER ARRAY[100]; -- associative array with integer value & varchar index CREATE TYPE AssocIntArrayVarIdx AS INTEGER ARRAY[VARCHAR(13)]; -- create a procedure that accepts and returns an associative array CREATE PROCEDURE PROC2 (IN InP1 INTEGER, IN InP2 AssocIntArrayVarIdx, INOUT InOutP1 AssocIntArrayVarIdx, OUT OutP1 AssocIntArrayVarIdx) BEGIN END;

49 Declaring Array Variables DECLARE Ordinary and Associative arrays via SQL-variable-declaration create a UDF that accepts and returns an ordinary array CREATE FUNCTION UDF1 (P1 OrdIntArray, P2 INTEGER) RETURNS OrdIntArray BEGIN -- declare two ordinary array with same array type DECLARE myordintarray OrdIntArray; DECLARE my2ndordintarray OrdIntArray; END; -- ordinary array with integer value & integer index CREATE TYPE OrdIntArray AS INTEGER ARRAY[100]; -- associative array with integer value & varchar index CREATE TYPE AssocIntArrayVarIdx AS INTEGER ARRAY[VARCHAR(13)]; -- create a procedure that accepts and returns an associative array CREATE PROCEDURE PROC2 (IN InP1 INTEGER, IN InP2 AssocIntArrayVarIdx, INOUT InOutP1 AssocIntArrayVarIdx, OUT OutP1 AssocIntArrayVarIdx) BEGIN -- declare two associative arrays with the same array type DECLARE myassocintarray AssocIntArrayVarIdx; DECLARE myassocintarray AssocIntArrayVarIdx; END;

50 Assigning values to Arrays Construct arrays with array-constructor and assign values with SET assignment-statement create a UDF that accepts and returns an ordinary array CREATE FUNCTION UDF1 (P1 OrdIntArray, P2 INTEGER) RETURNS OrdIntArray BEGIN -- declare two ordinary array with same array type DECLARE myordintarray OrdIntArray; DECLARE my2ndordintarray OrdIntArray; -- set an ordinary array with 3 values using an array-constructor SET myordintarray = ARRAY[10,20,30]; myordintarray Index Value set a 2nd ordinary array s array element, using array-element-specification SET my2ndordintarray[1] = myordintarray[3]; END; -- ordinary array with integer value & integer index CREATE TYPE OrdIntArray AS INTEGER ARRAY[100]; -- associative array with integer value & varchar index CREATE TYPE AssocIntArrayVarIdx AS INTEGER ARRAY[VARCHAR(13)]; my2ndordintarray Index Value 1 30

51 Build an Array from Table Data ARRAY_AGG Aggregate Function The ARRAY_AGG function returns an array where each value of the input set is assigned to an element of the array. CREATE TYPE OrdVchArray AS VARCHAR(12) ARRAY[100]; 51 DECLARE myordvcharray OrdVchArray; SET myordvcharray = (SELECT ARRAY_AGG(PHONE) FROM EMPLOYEE WHERE ID IS NOT NULL ORDER BY ID, PHONE); EMPLOYEE myordvcharray ID PHONE Index Value

52 Treating an Array Like a Table 52 Treat an array like a table i.e. fetch data from the array (using UNNEST collection-derived-table) just like you would from a table from-clause collection-derived-table A collection-derived-table can be used to convert the elements of one or more arrays into column values in separate rows of an intermediate result table Associative Array Example SELECT T.State, T.Population FROM UNNEST(myAssocIntArray) AS T(State,Population); myassocintarray Index Value California Oregon State Population California Oregon

53 Deleting Elements From An Array ARRAY_DELETE Scalar Function The ARRAY_DELETE function deletes elements from an array. The result of the function has the same data type as array-expression. 53 myassocintarray -- create a procedure that accepts and returns an associative array CREATE PROCEDURE PROC2 (IN InP1 INTEGER, IN InP2 AssocIntArrayVarIdx, INOUT InOutP1 AssocIntArrayVarIdx, OUT OutP1 AssocIntArrayVarIdx) BEGIN -- declare two associative arrays with the same array type DECLARE myassocintarray AssocIntArrayVarIdx; -- set an associative array with 5 values SET myassocintarray['california'] = ; SET myassocintarray['oregon'] = ; SET myassocintarray[new York'] = ; SET myassocintarray[ New Hampshire'] = 18000; -- remove the state of Oregon from the array SET myassocintarray = ARRAY_DELETE(myAssocIntArray, Oregon ); -- remove all states that begin with New from the array SET myassocintarray = ARRAY_DELETE(myAssocIntArray, New Hampshire, New York ); END; Index Value California New Hampshire New York Oregon myassocintarray Index Value California New Hampshire New York myassocintarray Index Value California

54 Finding an Array Element Index Name ARRAY_FIRST ARRAY_LAST ARRAY_NEXT ARRAY_PRIOR Description returns the minimum array index value of the array returns the maximum array index value of the array returns the next larger array index value for an array relative to the specified array index argument returns the next smaller array index value for an array relative to the specified array index argument -- create a procedure that accepts and returns an associative array CREATE PROCEDURE PROC2 (IN InP1 INTEGER, IN InP2 AssocIntArrayVarIdx, INOUT InOutP1 AssocIntArrayVarIdx, OUT OutP1 AssocIntArrayVarIdx) BEGIN -- declare local varchar variable DECLARE myvarchar, my2ndvarchar VARCHAR(20); -- declare two associative arrays with the same array type DECLARE myassocintarray AssocIntArrayVarIdx; -- set an associative array with 2 values SET myassocintarray['california'] = ; SET myassocintarray['oregon'] = ; sets a local variable to the index that follows California SET myvarchar = ARRAY_NEXT(myAssocIntArray, California ); END; myvarchar = Oregon

55 Autonomous Transactions 55

56 Autonomous Transactions An Autonomous Transactions is: A native SQL procedure that runs in its own unit of work May perform SQL, COMMITs, and ROLLBACK it s own SQL No uncommitted changes from it s caller are seen Locks are not shared between the caller and the autonomous procedure Upon completion of the autonomous procedure, a COMMIT is driven for the autonomous procedure when SQLCODE >=0 The caller s work is untouched Useful for event or audit logs 56 z/os Appl pgm INSERT INTO T1 CALL AutoTran_STP; ROLLBACK; T1 modifications unseen T2 committed but not T1 DB2 DBM1 AutoTran_STP: AutoTran_STP: BEGIN BEGIN UPDATE T2 UPDATE T2 END; END;

57 Creating & displaying autonomous transactions Specify AUTONOMOUS keyword on CREATE PROCEDURE or ALTER PROCEDURE statement s option-list 57 Display autonomous transaction state with -DISPLAY THREAD(*) command DB1G DISPLAY THREAD(*) STC00090 DSNV401I DB1G DISPLAY THREAD REPORT FOLLOWS STC00090 DSNV402I DB1G ACTIVE THREADS - NAME ST A REQ ID AUTHID PLAN ASID TOKEN BATCH SP * 1 APPLX USER001 PL01AP AT * 641 APPLX USER001 PL01AP01 002A 13

58 Global Variables 58

59 Global Variables Overview Benefits Allows users to share information across SQL statements Allows capability to set once, use everywhere Provides additional security via DB2 GRANT and REVOKE Characteristics Similar to special registers Their definitions are global and shared across different connections Their contents are only shared within the same connection Each connection maintains its own instantiation Their contents are NOT affected by COMMIT nor ROLLBACK Use only the UNICODE encoding scheme 59

60 Writing and Reading Global Variables WRITE to via: SET, SELECT INTO, VALUES INTO, OUT or inout parms READ from via: Anywhere an expression can be specified Exceptions check constraints, MQTs, views with WITH CHECK OPTION, keys (index on expressions, XML indexes, spatial indexes), arrays Values are locked in as soon as the following: View definition SQL scalar UDF or table UDF body Trigger action Row permission definition Column mask definition Auto-binding a package 60

61 Using and Referencing a Global Variable Create a global variable via new CREATE VARIABLE statement 61 Setting and referencing a global variable -- create a global variable CREATE VARIABLE Charge_Rate DECIMAL(4,2) DEFAULT 0.00; -- create a procedure that determines charge rate CREATE PROCEDURE Loan_Charge_Rate (IN ID CHAR(5)) BEGIN.. SELECT SCORE INTO Cust_Score FROM CUSTOMER WHERE ACCOUNT = ID; IF Cust_Score = Good THEN SET Charge_Rate = 1.0; ELSE SET Charge_Rate = 3.0; END; -- calling application myapp: PROCEDURE(Buyer, Amount); CALL Loan_Charge_Rate(Buyer); UPDATE CUSTOMER SET BALANCE = BALANCE + (Amount * Charge_Rate); END myapp;

62 Grouping Sets 62

63 Enhanced subselect group-by-clause 63 subselect group-by-clause

64 Syntax: grouping-sets and super-groups grouping-sets 64 super-groups

65 New Aggregations Grouping Sets Grouping sets allow multiple groups to be specified Querying and reporting are made easier and faster by producing a single result from essentially performing a UNION ALL of two or more groups of rows group-by-clause has been enhanced: grouping-sets Allows multiple grouping clauses to be specified in a single statement Allows the groups to be computed with a single pass over the data Can be used to determine subtotals and grand totals super-groups i.e. for a given group, calculate it s subtotal as well as the grand total for all groups Pre-defined grouping-sets ROLLUP CUBE 65

66 Predefined Grouping Sets - ROLLUP 66 ROLLUP Creates subtotals that roll up from the most detailed level to a grand total N elements translate to N+1 grouping sets: GROUP BY ROLLUP (C1,C2,C3) equivalent GROUP BY GROUPING SETS ((C1,C2,C3), (C1,C2), (C1), ()); The order specified is significant to the result: GROUP BY ROLLUP (C1,C2) equivalent GROUP BY GROUPING SETS ((C1,C2), (C1), ()); versus GROUP BY ROLLUP (C2,C1) equivalent GROUP BY GROUPING SETS ((C2,C1), (C2), ());

67 67 Predefined Grouping Sets - CUBE CUBE Creates subtotals for all permutations N elements translate to 2 n grouping sets: GROUP BY CUBE (C1,C2,C3) 3 elements equivalent 8 groups GROUP BY GROUPING SETS ( (C1,C2,C3), (C1,C2), (C1,C3), (C2,C3), (C1), (C2), (C3), ()); Unlike ROLLUP, the order specified is NOT significant to the result i.e. use ORDER BY to guarantee the order grand-total the overall aggregation of previous subtotals Both CUBE and ROLLUP return this row as the last row grand-total

68 68 GROUPING Aggregate Function Used to indicate whether or not the row was returned as a result of a grouping set i.e. the GROUPING aggregate function tells you the result of the grouping set was NULL versus the source row of the grouping set was NULL 1 0 the NULL value was generated by a super-group the NULL value is from the source row

69 GROUP BY GROUPING SETS - Example Example: Create a result set from the SALES table based on person and date. SELECT WEEK(SALES_DATE) as WEEK, DAYOFWEEK(SALES_DATE) AS DAY, SALES_PERSON, SUM(SALES) AS SOLD FROM SALES WHERE SALES_DATE > ' GROUP BY GROUPING SETS (WEEK(SALES_DATE), DAYOFWEEK(SALES_DATE), SALES_PERSON) 69 69

70 GROUP BY ROLLUP 70 An extension to the GROUP BY clause Produces a result set that contains sub-total rows. The sequence of the columns is significant. GROUP BY ROLLUP (a, b, c) is equal to GROUP BY (a, b, c) + GROUP BY (a, b) + GROUP BY (a) + grand-total Example SELECT WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES_DATE) AS DAY, SALES_PERSON, SUM(SALES) AS SOLD FROM SALES WHERE SALES_DATE > ' ' GROUP BY ROLLUP (WEEK(SALES_DATE), DAYOFWEEK(SALES_DATE), SALES_PERSON) ORDER BY WEEK(SALES_DATE), DAYOFWEEK(SALES_DATE), SALES_PERSON

71 71 GROUP BY ROLLUP results 71

72 GROUP BY CUBE An extension to the GROUP BY clause 72 Produces a result set that contains ROLLUP aggregation plus cross-tabulation rows. The sequence of the columns is not significant. GROUP BY CUBE (a, b, c) is equal to GROUP BY (a, b, c) + GROUP BY (a, b) + GROUP BY (a,c) + GROUP BY (b,c) + GROUP BY (a) + GROUP BY (b) + GROUP BY (c) + grand-total Example SELECT WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES_DATE) AS DAY, SALES_PERSON, SUM(SALES) AS SOLD FROM SALES WHERE SALES_DATE > ' ' GROUP BY CUBE (WEEK(SALES_DATE), DAYOFWEEK(SALES_DATE), SALES_PERSON) ORDER BY WEEK(SALES_DATE), DAYOFWEEK(SALES_DATE), SALES_PERSON

73 73 GROUP BY CUBE results 73

74 GROUP BY CUBE results contd

75 Summary 75

76 76 Summary DB2 10 and DB2 11 build on SQL function provided in previous releases with the following focus areas Native SQL Routines DB2 10 added Native SQL UDFs DB2 11 added the ARRAY datatype for use in SQL Routines DB2 11 added Autonomous SQL Procedures Analytic processing DB2 9 and DB2 10 Added OLAP Specification Support DB2 11 Added Cube, Rollup, and Grouping Sets Security DB2 10 added, and DB2 11 enhanced, Column Masking SQL Family and Vendor compatibility extensions Extensions needed to run popular applications requested by customers and vendors

77 Resources Requirements DB2 for z/os Information Center 2r2/index.jsp DB2 11 for z/os Technical Overview Redbook 77

78 78

79 79 Thank You Overview of DB2 10 and DB2 11 SQL Enhancements Christopher J. Crone IBM Session Code: F2 Monday November 10 th 12:00 PM Platform: DB2 for z/os

Overview of DB2 11 and DB2 12 SQL Enhancements

Overview of DB2 11 and DB2 12 SQL Enhancements Overview of DB2 11 and DB2 12 SQL Enhancements Christopher J. Crone IBM Session Code: 3 Platform: DB2 for z/os Agenda Overview of the Family DB2 11 DB2 12 Summary Overview of the Family DB2 SQL z DB2 11

More information

Application-enabling features of DB2 for z/os. June Charles Lewis DB2 for z/os Advisor IBM Mid-Atlantic Business Unit

Application-enabling features of DB2 for z/os. June Charles Lewis DB2 for z/os Advisor IBM Mid-Atlantic Business Unit Application-enabling features of DB2 for z/os June 2016 Charles Lewis DB2 for z/os Advisor IBM Mid-Atlantic Business Unit lewisc@us.ibm.com The aim of this presentation To help ensure that you are aware

More information

Oracle Syllabus Course code-r10605 SQL

Oracle Syllabus Course code-r10605 SQL Oracle Syllabus Course code-r10605 SQL Writing Basic SQL SELECT Statements Basic SELECT Statement Selecting All Columns Selecting Specific Columns Writing SQL Statements Column Heading Defaults Arithmetic

More information

Optional SQL Feature Summary

Optional SQL Feature Summary Optional SQL Feature Summary The following table lists all optional features included in the SQL standard, from SQL- 2003 to SQL-2016. It also indicates which features that are currently supported by Mimer

More information

1 Writing Basic SQL SELECT Statements 2 Restricting and Sorting Data

1 Writing Basic SQL SELECT Statements 2 Restricting and Sorting Data 1 Writing Basic SQL SELECT Statements Objectives 1-2 Capabilities of SQL SELECT Statements 1-3 Basic SELECT Statement 1-4 Selecting All Columns 1-5 Selecting Specific Columns 1-6 Writing SQL Statements

More information

Introduction to Computer Science and Business

Introduction to Computer Science and Business Introduction to Computer Science and Business This is the second portion of the Database Design and Programming with SQL course. In this portion, students implement their database design by creating a

More information

A Sneak Peak at DB2 9 for z/os

A Sneak Peak at DB2 9 for z/os IBM Software Group William Favero IBM S&D, West Region Senior Certified IT Software Specialist wfavero@attglobal.net Slide of 40 Shameless Self promotion http://blogs.ittoolbox.com/database/db2zos Slide

More information

Oracle Database 10g: Introduction to SQL

Oracle Database 10g: Introduction to SQL ORACLE UNIVERSITY CONTACT US: 00 9714 390 9000 Oracle Database 10g: Introduction to SQL Duration: 5 Days What you will learn This course offers students an introduction to Oracle Database 10g database

More information

DB2 for z/os is Serious About Analytics: Leveraging SQL to Analyze Your Data Where it Resides

DB2 for z/os is Serious About Analytics: Leveraging SQL to Analyze Your Data Where it Resides DB2 for z/os is Serious About Analytics: Leveraging SQL to Analyze Your Data Where it Resides Maryela Weihrauch, IBM Distinguished Engineer, weihrau@us.ibm.com Notices and disclaimers Copyright 2016 by

More information

5. Single-row function

5. Single-row function 1. 2. Introduction Oracle 11g Oracle 11g Application Server Oracle database Relational and Object Relational Database Management system Oracle internet platform System Development Life cycle 3. Writing

More information

Oracle Database 11g: SQL and PL/SQL Fundamentals

Oracle Database 11g: SQL and PL/SQL Fundamentals Oracle University Contact Us: +33 (0) 1 57 60 20 81 Oracle Database 11g: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn In this course, students learn the fundamentals of SQL and PL/SQL

More information

Listing of SQLSTATE values

Listing of SQLSTATE values Listing of values 1 of 28 5/15/2008 11:28 AM Listing of values The tables in this topic provide descriptions of codes that can be returned to applications by DB2 UDB for iseries. The tables include values,

More information

After completing this course, participants will be able to:

After completing this course, participants will be able to: Querying SQL Server T h i s f i v e - d a y i n s t r u c t o r - l e d c o u r s e p r o v i d e s p a r t i c i p a n t s w i t h t h e t e c h n i c a l s k i l l s r e q u i r e d t o w r i t e b a

More information

20461: Querying Microsoft SQL Server 2014 Databases

20461: Querying Microsoft SQL Server 2014 Databases Course Outline 20461: Querying Microsoft SQL Server 2014 Databases Module 1: Introduction to Microsoft SQL Server 2014 This module introduces the SQL Server platform and major tools. It discusses editions,

More information

20761 Querying Data with Transact SQL

20761 Querying Data with Transact SQL Course Overview The main purpose of this course is to give students a good understanding of the Transact-SQL language which is used by all SQL Server-related disciplines; namely, Database Administration,

More information

Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:

Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course: Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course: 20762C Developing SQL 2016 Databases Module 1: An Introduction to Database Development Introduction to the

More information

DB2 SQL Class Outline

DB2 SQL Class Outline DB2 SQL Class Outline The Basics of SQL Introduction Finding Your Current Schema Setting Your Default SCHEMA SELECT * (All Columns) in a Table SELECT Specific Columns in a Table Commas in the Front or

More information

Course Outline and Objectives: Database Programming with SQL

Course Outline and Objectives: Database Programming with SQL Introduction to Computer Science and Business Course Outline and Objectives: Database Programming with SQL This is the second portion of the Database Design and Programming with SQL course. In this portion,

More information

Oracle Database: Introduction to SQL Ed 2

Oracle Database: Introduction to SQL Ed 2 Oracle University Contact Us: +40 21 3678820 Oracle Database: Introduction to SQL Ed 2 Duration: 5 Days What you will learn This Oracle Database 12c: Introduction to SQL training helps you write subqueries,

More information

COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014

COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014 COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014 MODULE 1: INTRODUCTION TO MICROSOFT SQL SERVER 2014 This module introduces the SQL Server platform and major tools. It discusses editions, versions,

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the fundamentals of SQL and PL/SQL along with the

More information

Oracle Developer Track Course Contents. Mr. Sandeep M Shinde. Oracle Application Techno-Functional Consultant

Oracle Developer Track Course Contents. Mr. Sandeep M Shinde. Oracle Application Techno-Functional Consultant Oracle Developer Track Course Contents Sandeep M Shinde Oracle Application Techno-Functional Consultant 16 Years MNC Experience in India and USA Trainer Experience Summary:- Sandeep M Shinde is having

More information

Oracle Database: SQL and PL/SQL Fundamentals Ed 2

Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Course Code: M20461 Vendor: Microsoft Course Overview Duration: 5 RRP: POA Querying Microsoft SQL Server Overview This 5-day instructor led course provides delegates with the technical skills required

More information

IBM i Version 7.3. Database SQL programming IBM

IBM i Version 7.3. Database SQL programming IBM IBM i Version 7.3 Database SQL programming IBM IBM i Version 7.3 Database SQL programming IBM Note Before using this information and the product it supports, read the information in Notices on page 405.

More information

20461: Querying Microsoft SQL Server

20461: Querying Microsoft SQL Server 20461: Querying Microsoft SQL Server Length: 5 days Audience: IT Professionals Level: 300 OVERVIEW This 5 day instructor led course provides students with the technical skills required to write basic Transact

More information

Querying Microsoft SQL Server (MOC 20461C)

Querying Microsoft SQL Server (MOC 20461C) Querying Microsoft SQL Server 2012-2014 (MOC 20461C) Course 21461 40 Hours This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for

More information

DB2 9 for z/os Trends and directions. May 28, Euroclear IBM Corporation IBM Systems

DB2 9 for z/os Trends and directions. May 28, Euroclear IBM Corporation IBM Systems DB2 9 for z/os Trends and directions May 28, 2008 Euroclear 2008 IBM Corporation IBM Systems DB2 for z/os Version 8 Changes since 2004 now Cross loader with LOBs Built in functions ASCII, TIMESTAMPDIFF

More information

Db2 for z/os is Serious About Analytics: Leveraging SQL to Analyze Your Data Where it Resides

Db2 for z/os is Serious About Analytics: Leveraging SQL to Analyze Your Data Where it Resides Db2 for z/os is Serious About Analytics: Leveraging SQL to Analyze Your Data Where it Resides Maryela Weihrauch, IBM Distinguished Engineer, weihrau@us.ibm.com Notices and disclaimers Copyright 2016 by

More information

Course 20461C: Querying Microsoft SQL Server

Course 20461C: Querying Microsoft SQL Server Course 20461C: Querying Microsoft SQL Server Audience Profile About this Course This course is the foundation for all SQL Serverrelated disciplines; namely, Database Administration, Database Development

More information

MIS NETWORK ADMINISTRATOR PROGRAM

MIS NETWORK ADMINISTRATOR PROGRAM NH107-7475 SQL: Querying and Administering SQL Server 2012-2014 136 Total Hours 97 Theory Hours 39 Lab Hours COURSE TITLE: SQL: Querying and Administering SQL Server 2012-2014 PREREQUISITE: Before attending

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Querying Microsoft SQL Server 20461D; 5 days, Instructor-led Course Description This 5-day instructor led course provides students with the technical skills required to write basic Transact SQL queries

More information

IBM i Version 7.2. Database SQL programming IBM

IBM i Version 7.2. Database SQL programming IBM IBM i Version 7.2 Database SQL programming IBM IBM i Version 7.2 Database SQL programming IBM Note Before using this information and the product it supports, read the information in Notices on page 389.

More information

COURSE OUTLINE: Querying Microsoft SQL Server

COURSE OUTLINE: Querying Microsoft SQL Server Course Name 20461 Querying Microsoft SQL Server Course Duration 5 Days Course Structure Instructor-Led (Classroom) Course Overview This 5-day instructor led course provides students with the technical

More information

EDUVITZ TECHNOLOGIES

EDUVITZ TECHNOLOGIES EDUVITZ TECHNOLOGIES Oracle Course Overview Oracle Training Course Prerequisites Computer Fundamentals, Windows Operating System Basic knowledge of database can be much more useful Oracle Training Course

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server 20461 - Querying Microsoft SQL Server Duration: 5 Days Course Price: $2,975 Software Assurance Eligible Course Description About this course This 5-day instructor led course provides students with the

More information

Course Outline. Querying Data with Transact-SQL Course 20761B: 5 days Instructor Led

Course Outline. Querying Data with Transact-SQL Course 20761B: 5 days Instructor Led Querying Data with Transact-SQL Course 20761B: 5 days Instructor Led About this course This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days

More information

Principles of Data Management

Principles of Data Management Principles of Data Management Alvin Lin August 2018 - December 2018 Structured Query Language Structured Query Language (SQL) was created at IBM in the 80s: SQL-86 (first standard) SQL-89 SQL-92 (what

More information

Oracle SQL & PL SQL Course

Oracle SQL & PL SQL Course Oracle SQL & PL SQL Course Complete Practical & Real-time Training Job Support Complete Practical Real-Time Scenarios Resume Preparation Lab Access Training Highlights Placement Support Support Certification

More information

My Favorite Things in DB2 11 for z/os

My Favorite Things in DB2 11 for z/os My Favorite Things in DB2 11 for z/os Martin Hubel + 1 905-764-7498 martin@mhubel.com www.mhubel.com Copyright 2015 Martin Hubel Consulting Inc. 1 Frame of Reference I have worked with DB2 for z/os since

More information

AVANTUS TRAINING PTE LTD

AVANTUS TRAINING PTE LTD [MS20461]: Querying Microsoft SQL Server 2014 Length : 5 Days Audience(s) : IT Professionals Level : 300 Technology : SQL Server Delivery Method : Instructor-led (Classroom) Course Overview This 5-day

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Querying Microsoft SQL Server Duration: 5 Days (08:30-16:00) Overview: This course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server. This

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Querying Data with Transact-SQL 20761B; 5 Days; Instructor-led Course Description This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can

More information

IBM i Version 7.3. Database SQL messages and codes IBM

IBM i Version 7.3. Database SQL messages and codes IBM IBM i Version 7.3 Database SQL messages and codes IBM IBM i Version 7.3 Database SQL messages and codes IBM Note Before using this information and the product it supports, read the information in Notices

More information

20761B: QUERYING DATA WITH TRANSACT-SQL

20761B: QUERYING DATA WITH TRANSACT-SQL ABOUT THIS COURSE This 5 day course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can be taught as a course to students requiring the knowledge

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Querying Data with Transact-SQL General Description This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can be taught as a course to students

More information

Oracle Database 12c SQL Fundamentals

Oracle Database 12c SQL Fundamentals Course Overview This course takes a unique approach to SQL training in that it incorporates data modeling theory, relational database theory, graphical depictions of theoretical concepts and numerous examples

More information

Querying Microsoft SQL Server

Querying Microsoft SQL Server Querying Microsoft SQL Server Course 20461D 5 Days Instructor-led, Hands-on Course Description This 5-day instructor led course is designed for customers who are interested in learning SQL Server 2012,

More information

QUERYING MICROSOFT SQL SERVER COURSE OUTLINE. Course: 20461C; Duration: 5 Days; Instructor-led

QUERYING MICROSOFT SQL SERVER COURSE OUTLINE. Course: 20461C; Duration: 5 Days; Instructor-led CENTER OF KNOWLEDGE, PATH TO SUCCESS Website: QUERYING MICROSOFT SQL SERVER Course: 20461C; Duration: 5 Days; Instructor-led WHAT YOU WILL LEARN This 5-day instructor led course provides students with

More information

Data types String data types Numeric data types Date, time, and timestamp data types XML data type Large object data types ROWID data type

Data types String data types Numeric data types Date, time, and timestamp data types XML data type Large object data types ROWID data type Data types Every column in every DB2 table has a data type. The data type influences the range of values that the column can have and the set of operators and functions that apply to it. You specify the

More information

DB2 9 for z/os Overview LSU 2009

DB2 9 for z/os Overview LSU 2009 DB 9 for z/os Overview LSU 009 Brief DB History V9 V. V. V. V. V. Sequential Prefetch Referential Integrity Explain Sequential Detection V. Packages V Parallel IO Hiperspaces Data Sharing T Indexes Stored

More information

Deccansoft softwareservices-microsoft Silver Learing Partner. SQL Server Syllabus

Deccansoft softwareservices-microsoft Silver Learing Partner. SQL Server Syllabus SQL Server Syllabus Overview: Microsoft SQL Server is one the most popular Relational Database Management System (RDBMS) used in Microsoft universe. It can be used for data storage as well as for data

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Querying Data with Transact-SQL Course 20761C 5 Days Instructor-led, Hands on Course Information The main purpose of the course is to give students a good understanding of the Transact- SQL language which

More information

IBM DB2 for z/os Application Developer Certification

IBM DB2 for z/os Application Developer Certification IBM DB2 for z/os Application Developer Certification Professional Certification Exam Copyright 2018 Computer Business International, Inc. www.cbi4you.com 1 What does it involve? IBM DB2 for z/os Application

More information

"Charting the Course to Your Success!" MOC D Querying Microsoft SQL Server Course Summary

Charting the Course to Your Success! MOC D Querying Microsoft SQL Server Course Summary Course Summary Description This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2014. This course is the foundation

More information

C Examcollection.Premium.Exam.58q

C Examcollection.Premium.Exam.58q C2090-610.Examcollection.Premium.Exam.58q Number: C2090-610 Passing Score: 800 Time Limit: 120 min File Version: 32.2 http://www.gratisexam.com/ Exam Code: C2090-610 Exam Name: DB2 10.1 Fundamentals Visualexams

More information

Duration Level Technology Delivery Method Training Credits. Classroom ILT 5 Days Intermediate SQL Server

Duration Level Technology Delivery Method Training Credits. Classroom ILT 5 Days Intermediate SQL Server NE-20761C Querying with Transact-SQL Summary Duration Level Technology Delivery Method Training Credits Classroom ILT 5 Days Intermediate SQL Virtual ILT On Demand SATV Introduction This course is designed

More information

Oracle. SQL(Structured Query Language) Introduction of DBMS. Build In Function. Introduction of RDBMS. Grouping the Result of a Query

Oracle. SQL(Structured Query Language) Introduction of DBMS. Build In Function. Introduction of RDBMS. Grouping the Result of a Query Oracle SQL(Structured Query Language) Introduction of DBMS Approach to Data Management Introduction to prerequisites File and File system Disadvantages of file system Introduction to TOAD and oracle 11g/12c

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Querying Data with Transact-SQL Duration: 5 Days Course Code: M20761 Overview: This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can

More information

normalization are being violated o Apply the rule of Third Normal Form to resolve a violation in the model

normalization are being violated o Apply the rule of Third Normal Form to resolve a violation in the model Database Design Section1 - Introduction 1-1 Introduction to the Oracle Academy o Give examples of jobs, salaries, and opportunities that are possible by participating in the Academy. o Explain how your

More information

Symptom. Environment. Resolution What words are reserved and cannot be used in BPC? Version 3 Validity:

Symptom. Environment. Resolution What words are reserved and cannot be used in BPC? Version 3 Validity: SAP Knowledge Base Article 1632682 - What words are reserved and cannot be used in BPC? Version 3 Validity: 16.09.2011 - active Language English Symptom What words are reserved and cannot be used in Business

More information

Sql Server Syllabus. Overview

Sql Server Syllabus. Overview Sql Server Syllabus Overview This SQL Server training teaches developers all the Transact-SQL skills they need to create database objects like Tables, Views, Stored procedures & Functions and triggers

More information

Table of Contents Chapter 1 - Introduction Chapter 2 - Designing XML Data and Applications Chapter 3 - Designing and Managing XML Storage Objects

Table of Contents Chapter 1 - Introduction Chapter 2 - Designing XML Data and Applications Chapter 3 - Designing and Managing XML Storage Objects Table of Contents Chapter 1 - Introduction 1.1 Anatomy of an XML Document 1.2 Differences Between XML and Relational Data 1.3 Overview of DB2 purexml 1.4 Benefits of DB2 purexml over Alternative Storage

More information

Querying Microsoft SQL Server 2012/2014

Querying Microsoft SQL Server 2012/2014 Page 1 of 14 Overview This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2014. This course is the foundation

More information

20461D: Querying Microsoft SQL Server

20461D: Querying Microsoft SQL Server 20461D: Querying Microsoft SQL Server Course Details Course Code: Duration: Notes: 20461D 5 days This course syllabus should be used to determine whether the course is appropriate for the students, based

More information

A Unit of SequelGate Innovative Technologies Pvt. Ltd. All Training Sessions are Completely Practical & Real-time

A Unit of SequelGate Innovative Technologies Pvt. Ltd. All Training Sessions are Completely Practical & Real-time SQL Basics & PL-SQL Complete Practical & Real-time Training Sessions A Unit of SequelGate Innovative Technologies Pvt. Ltd. ISO Certified Training Institute Microsoft Certified Partner Training Highlights

More information

20761C: Querying Data with Transact-SQL

20761C: Querying Data with Transact-SQL 20761C: Querying Data with Transact-SQL Course Details Course Code: Duration: Notes: 20761C 5 days This course syllabus should be used to determine whether the course is appropriate for the students, based

More information

Querying Microsoft SQL Server (461)

Querying Microsoft SQL Server (461) Querying Microsoft SQL Server 2012-2014 (461) Create database objects Create and alter tables using T-SQL syntax (simple statements) Create tables without using the built in tools; ALTER; DROP; ALTER COLUMN;

More information

Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept]

Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept] Interview Questions on DBMS and SQL [Compiled by M V Kamal, Associate Professor, CSE Dept] 1. What is DBMS? A Database Management System (DBMS) is a program that controls creation, maintenance and use

More information

Vendor: IBM. Exam Code: C Exam Name: DB Fundamentals. Version: Demo

Vendor: IBM. Exam Code: C Exam Name: DB Fundamentals. Version: Demo Vendor: IBM Exam Code: C2090-610 Exam Name: DB2 10.1 Fundamentals Version: Demo QUESTION 1 If the following command is executed: CREATE DATABASE test What is the page size (in kilobytes) of the database?

More information

Optimize SQL Performance on DB2 for i. Strategies to make your query and application as fast as possible.

Optimize SQL Performance on DB2 for i. Strategies to make your query and application as fast as possible. Optimize SQL Performance on DB2 for i Strategies to make your query and application as fast as possible. Today s Speaker Andrew Clark CTO RT Analytics aclark@rtanalytics.com 2 Today s Agenda How Optimization

More information

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Basic SQL Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries

More information

Standard SQL Reserved Words Summary

Standard SQL Reserved Words Summary Standard SQL Reserved Words Summary The following table lists all reserved words in the SQL standard, from SQL-92 to SQL- 2016. Note! Mimer SQL does not add any additional reserved words. In fact, Mimer

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: 001-855-844-3881 & 001-800-514-06-9 7 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training

More information

Querying Data with Transact-SQL

Querying Data with Transact-SQL Course Code: M20761 Vendor: Microsoft Course Overview Duration: 5 RRP: 2,177 Querying Data with Transact-SQL Overview This course is designed to introduce students to Transact-SQL. It is designed in such

More information

Querying Microsoft SQL Server 2008/2012

Querying Microsoft SQL Server 2008/2012 Querying Microsoft SQL Server 2008/2012 Course 10774A 5 Days Instructor-led, Hands-on Introduction This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL

More information

Meet MariaDB Vicențiu Ciorbaru Software MariaDB Foundation * * 2017 MariaDB Foundation

Meet MariaDB Vicențiu Ciorbaru Software MariaDB Foundation * * 2017 MariaDB Foundation Meet MariaDB 10.3 Vicențiu Ciorbaru Software Engineer @ MariaDB Foundation vicentiu@mariadb.org * * What is MariaDB? MariaDB 5.1 (Feb 2010) - Making builds free MariaDB 5.2 (Nov 2010) - Community features

More information

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 8 Advanced SQL

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management Tenth Edition Chapter 8 Advanced SQL Objectives In this chapter, you will learn: How to use the advanced SQL JOIN operator syntax About the different

More information

IBM EXAM QUESTIONS & ANSWERS

IBM EXAM QUESTIONS & ANSWERS IBM 000-730 EXAM QUESTIONS & ANSWERS Number: 000-730 Passing Score: 800 Time Limit: 120 min File Version: 69.9 http://www.gratisexam.com/ IBM 000-730 EXAM QUESTIONS & ANSWERS Exam Name: DB2 9 Fundamentals

More information

Working with DB2 Data Using SQL and XQuery Answers

Working with DB2 Data Using SQL and XQuery Answers Working with DB2 Data Using SQL and XQuery Answers 66. The correct answer is D. When a SELECT statement such as the one shown is executed, the result data set produced will contain all possible combinations

More information

Creating and Managing Tables Schedule: Timing Topic

Creating and Managing Tables Schedule: Timing Topic 9 Creating and Managing Tables Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe the

More information

"Charting the Course... MOC C: Querying Data with Transact-SQL. Course Summary

Charting the Course... MOC C: Querying Data with Transact-SQL. Course Summary Course Summary Description This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can be taught as a course to students requiring the knowledge

More information

ORACLE TRAINING. ORACLE Training Course syllabus ORACLE SQL ORACLE PLSQL. Oracle SQL Training Syllabus

ORACLE TRAINING. ORACLE Training Course syllabus ORACLE SQL ORACLE PLSQL. Oracle SQL Training Syllabus ORACLE TRAINING ORACLE Training Course syllabus ORACLE SQL ORACLE PLSQL Oracle SQL Training Syllabus Introduction to Oracle Database List the features of Oracle Database 11g Discuss the basic design, theoretical,

More information

DB2 SQL Tuning Tips for z/os Developers

DB2 SQL Tuning Tips for z/os Developers DB2 SQL Tuning Tips for z/os Developers Tony Andrews IBM Press, Pearson pic Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid Cape Town Sydney

More information

Oracle 12C DBA Online Training. Course Modules of Oracle 12C DBA Online Training: 1 Oracle Database 12c: Introduction to SQL:

Oracle 12C DBA Online Training. Course Modules of Oracle 12C DBA Online Training: 1 Oracle Database 12c: Introduction to SQL: Course Modules of Oracle 12C DBA Online Training: 1 Oracle Database 12c: Introduction to SQL: A. Introduction Course Objectives, Course Agenda and Appendixes Used in this Course Overview of Oracle Database

More information

AO3 - Version: 2. Oracle Database 11g SQL

AO3 - Version: 2. Oracle Database 11g SQL AO3 - Version: 2 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries against

More information

618 Index. BIT data type, 108, 109 BIT_LENGTH, 595f BIT VARYING data type, 108 BLOB data type, 108 Boolean data type, 109

618 Index. BIT data type, 108, 109 BIT_LENGTH, 595f BIT VARYING data type, 108 BLOB data type, 108 Boolean data type, 109 Index A abbreviations in field names, 22 in table names, 31 Access. See under Microsoft acronyms in field names, 22 in table names, 31 aggregate functions, 74, 375 377, 416 428. See also AVG; COUNT; COUNT(*);

More information

Oracle PL SQL Training & Certification

Oracle PL SQL Training & Certification About Intellipaat Intellipaat is a fast-growing professional training provider that is offering training in over 150 most sought-after tools and technologies. We have a learner base of 600,000 in over

More information

Microsoft Querying Microsoft SQL Server 2014

Microsoft Querying Microsoft SQL Server 2014 1800 ULEARN (853 276) www.ddls.com.au Microsoft 20461 - Querying Microsoft SQL Server 2014 Length 5 days Price $4290.00 (inc GST) Version D Overview Please note: Microsoft have released a new course which

More information

Number: Passing Score: 800 Time Limit: 120 min File Version:

Number: Passing Score: 800 Time Limit: 120 min File Version: 000-610 Number: 000-610 Passing Score: 800 Time Limit: 120 min File Version: 1.0 http://www.gratisexam.com/ Exam A QUESTION 1 If the following command is executed: CREATE DATABASE test What is the page

More information

An Introduction to SQL for System i. A beginning overview of SQL in System i Navigator and Embedded SQL in RPGLE

An Introduction to SQL for System i. A beginning overview of SQL in System i Navigator and Embedded SQL in RPGLE An Introduction to SQL for System i A beginning overview of SQL in System i Navigator and Embedded SQL in RPGLE Quote heard from IBM at a Conference 80% of everything you will need to know three years

More information

Using SQL with SQL Developer 18.2

Using SQL with SQL Developer 18.2 One Introduction to SQL 2 - Definition 3 - Usage of SQL 4 - What is SQL used for? 5 - Who uses SQL? 6 - Definition of a Database 7 - What is SQL Developer? 8 Two The SQL Developer Interface 9 - Introduction

More information

Lab # 4. Data Definition Language (DDL)

Lab # 4. Data Definition Language (DDL) Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Lab # 4 Data Definition Language (DDL) Eng. Haneen El-Masry November, 2014 2 Objective To be familiar with

More information

Slides by: Ms. Shree Jaswal

Slides by: Ms. Shree Jaswal Slides by: Ms. Shree Jaswal Overview of SQL, Data Definition Commands, Set operations, aggregate function, null values, Data Manipulation commands, Data Control commands, Views in SQL, Complex Retrieval

More information

Greenplum SQL Class Outline

Greenplum SQL Class Outline Greenplum SQL Class Outline The Basics of Greenplum SQL Introduction SELECT * (All Columns) in a Table Fully Qualifying a Database, Schema and Table SELECT Specific Columns in a Table Commas in the Front

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 6 Basic SQL Slide 6-2 Chapter 6 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features

More information

Querying Data with Transact SQL

Querying Data with Transact SQL Course 20761A: Querying Data with Transact SQL Course details Course Outline Module 1: Introduction to Microsoft SQL Server 2016 This module introduces SQL Server, the versions of SQL Server, including

More information

The DB2Night Show Episode #88. Real Time Warehousing with IBM InfoSphere Warehouse V10

The DB2Night Show Episode #88. Real Time Warehousing with IBM InfoSphere Warehouse V10 The DB2Night Show Episode #88 Real Time Warehousing with IBM InfoSphere Warehouse V10 Pat Bates, WW Technical Sales for Big Data and Warehousing, jpbates@us.ibm.com June 26, 2012 June 26, 2012 Deployment

More information

GridDB Advanced Edition SQL reference

GridDB Advanced Edition SQL reference GMA022C1 GridDB Advanced Edition SQL reference Toshiba Solutions Corporation 2016 All Rights Reserved. Introduction This manual describes how to write a SQL command in the GridDB Advanced Edition. Please

More information

Querying Microsoft SQL Server 2014

Querying Microsoft SQL Server 2014 Querying Microsoft SQL Server 2014 Código del curso: 20461 Duración: 5 días Acerca de este curso This 5 day instructor led course provides students with the technical skills required to write basic Transact

More information