V6R1 – Database enhancements <ul><li>DECFLOAT data type  </li></ul><ul><li>BX literals  </li></ul><ul><li>FOR BIT DATA and...
<ul><li>TIMESTAMP_FORMAT scalar functions and VARCHAR_FORMAT scalar function enhancements  </li></ul><ul><li>MONTHS_BETWEE...
<ul><li>Skip Locks  </li></ul><ul><li>Several restrictions related to NLSS, translation, UDTFs, and lateral correlation ha...
<ul><li>NCHAR, NVARCHAR, and NCLOB  </li></ul><ul><li>Expressions in indexes  </li></ul><ul><li>Hidden columns  </li></ul>...
<ul><li>128-byte cursor and statement names  </li></ul><ul><li>More than 120 columns in GROUP BY  </li></ul><ul><li>Remove...
Grouping Sets and Super  Groups <ul><li>SELECT SALES_DATE, SALES_PERSON, SUM(SALES) AS UNITS_SOLD, GROUPING(SALES_DATE) AS...
SALES_DATE SALES_PERSON UNITS_SOLD DATE_GROUP SALES_GROUP ---------- ------------ ---------- ---------- -----------  12/31...
SELECT WEEK(SALES_DATE) AS WEEK,  DAYOFWEEK(SALES_DATE) AS DAY_WEEK,  SALES_PERSON, SUM(SALES) AS UNITS_SOLD  FROM SALES  ...
WEEK  DAY_WEEK  SALES_PERSON  UNITS_SOLD  ------- ---------- ------------- ------------  13  6 GOUNOT  11  13  6 LEE  12  ...
SET :RND_TMSTMP =  ROUND_TIMESTAMP(’2000-03-18-17.30.00’, ’MONTH’); Returns: 2000-04-01-00.00.00.000000.
VALUES on FROM  Allows programmer to dynamically generate & populate temporary tables as part of the query definition – ...
Insert in From <ul><li>Useful for: </li></ul><ul><li>Default values </li></ul><ul><li>Identity Columns </li></ul><ul><li>B...
Insert in From CREATE TABLE EMPSAMP  (EMPNO  INTEGER GENERATED ALWAYS AS IDENTITY, NAME  CHAR(30), SALARY  DECIMAL(10,2), ...
Full Outer Join FileA AKey  AText A  01 B  Shoe FileB Bkey  BText B  Wallet C  Purse Select AKey,Bkey,Atext,Btext From Fil...
Hidden Timestamp CREATE TABLE tickets( ticket_ord INTEGER, ticket_qty INTEGER, ticket_event VARCHAR(10), ticket_ts TIMESTA...
Hidden Timestamp SELECT * FROM tickets UPDATE tickets SET ticket_qty = 6 WHERE ticket_ord = 2; SELECT ticket_ord, ticket_q...
Bibliography What’s new for V6R1 in SQL Programming http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/sqlp...
Upcoming SlideShare
Loading in...5
×

Presentation for February 2008 "V6R1 Database enhancements by ...

354

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
354
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Presentation for February 2008 "V6R1 Database enhancements by ...

  1. 1. V6R1 – Database enhancements <ul><li>DECFLOAT data type </li></ul><ul><li>BX literals </li></ul><ul><li>FOR BIT DATA and binary compatibility </li></ul><ul><li>Client special registers </li></ul><ul><li>Grouping Sets and Super groups </li></ul><ul><li>ASCII and CHR scalar functions </li></ul><ul><li>ENCRYPT_AES scalar function </li></ul>
  2. 2. <ul><li>TIMESTAMP_FORMAT scalar functions and VARCHAR_FORMAT scalar function enhancements </li></ul><ul><li>MONTHS_BETWEEN, ROUND_TIMESTAMP and TRUNC_TIMESTAMP scalar functions </li></ul><ul><li>VALUES in SELECT </li></ul><ul><li>INSERT in FROM </li></ul><ul><li>Full Outer Join </li></ul>
  3. 3. <ul><li>Skip Locks </li></ul><ul><li>Several restrictions related to NLSS, translation, UDTFs, and lateral correlation have been removed </li></ul><ul><li>Ignore unsupported DDL syntax </li></ul><ul><li>SYSTOOLS and SYSIBMADM schemas </li></ul><ul><li>ALTER FUNCTION </li></ul><ul><li>COMMENT and LABEL enhancements </li></ul>
  4. 4. <ul><li>NCHAR, NVARCHAR, and NCLOB </li></ul><ul><li>Expressions in indexes </li></ul><ul><li>Hidden columns </li></ul><ul><li>Auto-generated timestamps </li></ul><ul><li>FOR EACH STATEMENT on INSTEAD OF triggers </li></ul><ul><li>Indicator variable values that indicate no update </li></ul>
  5. 5. <ul><li>128-byte cursor and statement names </li></ul><ul><li>More than 120 columns in GROUP BY </li></ul><ul><li>Remove number of schemas limit </li></ul><ul><li>Several new statistical views </li></ul><ul><li>RPG variables within procedure scope </li></ul><ul><li>Precompiler support for IFS source </li></ul>
  6. 6. Grouping Sets and Super Groups <ul><li>SELECT SALES_DATE, SALES_PERSON, SUM(SALES) AS UNITS_SOLD, GROUPING(SALES_DATE) AS DATE_GROUP, GROUPING(SALES_PERSON) AS SALES_GROUP FROM SALES GROUP BY CUBE( SALES_DATE, SALES_PERSON) ORDER BY SALES_DATE, SALES_PERSON </li></ul>
  7. 7. SALES_DATE SALES_PERSON UNITS_SOLD DATE_GROUP SALES_GROUP ---------- ------------ ---------- ---------- ----------- 12/31/1995 GOUNOT 1 0 0 12/31/1995 LEE 6 0 0 12/31/1995 LUCCHESSI 1 0 0 12/31/1995 - 8 0 1 03/29/1996 GOUNOT 11 0 0 03/29/1996 LEE 12 0 0 03/29/1996 LUCCHESSI 4 0 0 03/29/1996 - 27 0 1 … - GOUNOT 50 1 0 - LEE 91 1 0 - LUCCHESSI 14 1 0 - - 155 1 1
  8. 8. SELECT WEEK(SALES_DATE) AS WEEK, DAYOFWEEK(SALES_DATE) AS DAY_WEEK, SALES_PERSON, SUM(SALES) AS UNITS_SOLD FROM SALES WHERE WEEK(SALES_DATE) = 13 GROUP BY ROLLUP( WEEK(SALES_DATE), DAYOFWEEK(SALES_DATE), SALES_PERSON ) ORDER BY WEEK, DAY_WEEK, SALES_PERSON
  9. 9. WEEK DAY_WEEK SALES_PERSON UNITS_SOLD ------- ---------- ------------- ------------ 13 6 GOUNOT 11 13 6 LEE 12 13 6 LUCCHESSI 4 13 6 – 27 13 7 GOUNOT 21 13 7 LEE 21 13 7 LUCCHESSI 4 13 7 - 46 13 - - 73 - - - 73
  10. 10. SET :RND_TMSTMP = ROUND_TIMESTAMP(’2000-03-18-17.30.00’, ’MONTH’); Returns: 2000-04-01-00.00.00.000000.
  11. 11. VALUES on FROM  Allows programmer to dynamically generate & populate temporary tables as part of the query definition – Enable SQL access of in-memory tables maintained by application – Supports table-less queries Examples: SELECT deptnum, deptname FROM org WHERE deptnum <20 UNION ALL SELECT * FROM ( VALUES (77,'New Department')) AS tmp(c1,c2) WITH proposedRates(prType, prRate) AS ( VALUES (?,?),(?,?),(?,?),(?,?) ) SELECT rmtype, prRate, ((prRate – rmRate)/rmRate)*100 AS RateChgPercent FROM rooms, proposedRates WHERE rmtype = prType ORDER BY RateChgPercent DESC
  12. 12. Insert in From <ul><li>Useful for: </li></ul><ul><li>Default values </li></ul><ul><li>Identity Columns </li></ul><ul><li>Before insert triggers </li></ul>
  13. 13. Insert in From CREATE TABLE EMPSAMP (EMPNO INTEGER GENERATED ALWAYS AS IDENTITY, NAME CHAR(30), SALARY DECIMAL(10,2), DEPTNO SMALLINT, LEVEL CHAR(30), HIRETYPE VARCHAR(30) NOT NULL DEFAULT 'New Employee', HIREDATE DATE NOT NULL WITH DEFAULT) SELECT EMPNO, HIRETYPE, HIREDATE FROM FINAL TABLE ( INSERT INTO EMPSAMP (NAME, SALARY, DEPTNO, LEVEL) VALUES('Mary Smith', 35000.00, 11, 'Associate'))
  14. 14. Full Outer Join FileA AKey AText A 01 B Shoe FileB Bkey BText B Wallet C Purse Select AKey,Bkey,Atext,Btext From FileA full outer join FileB on Atext=Btext A,-,01,- B,B,Shoe,Wallet -,C,-,Purse
  15. 15. Hidden Timestamp CREATE TABLE tickets( ticket_ord INTEGER, ticket_qty INTEGER, ticket_event VARCHAR(10), ticket_ts TIMESTAMP NOT NULL IMPLICITLY HIDDEN FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP ); INSERT INTO tickets VALUES(1,11,’mvGAME1’),(2,8,’ihGAME4’);
  16. 16. Hidden Timestamp SELECT * FROM tickets UPDATE tickets SET ticket_qty = 6 WHERE ticket_ord = 2; SELECT ticket_ord, ticket_qty, ticket_event, ticket_ts FROM tickets Non-SQL interfaces automatically include any hidden columns
  17. 17. Bibliography What’s new for V6R1 in SQL Programming http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/sqlp/rbafywhatsnew.htm What’s new for V6R1 in SQL Reference http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/db2/rbafzwhatsnew.htm System i Technical Overviews http://www-304.ibm.com/jct01004c/systems/support/i/library/techoverviews/ DB2 for i5/OS SQL Reference http://publib.boulder.ibm.com/infocenter/systems/scope/i5os/topic/db2/rbafz.pdf Presentations http://www.statususer.org/html/newsletterArchive.html
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×