Copyright 2007, Information Builders. Slide 1 Walter Brengel Information Builders New Jersey User Forum – June 2008 FOCUS to SQL DeMystified
Copyright 2007, Information Builders. Slide 2 FOCUS To SQL DeMystified - Agenda n SQL Overview n SQL Traces n Verb Objects n Sorting n Record Selection n Defining Fields n Combining Files
Copyright 2007, Information Builders. Slide 3 Generic Across Databases Generic Across Databases Language Used By The Relational Database Management System (RDBMS). Language Used By The Relational Database Management System (RDBMS). Differences: Differences: WHERE Masking Using LIKE (% vs *) WHERE Masking Using LIKE (% vs *) Functions Functions Mostly – Generic Statement Will Work Across Databases Mostly – Generic Statement Will Work Across Databases Allows Selecting, Inserting And Updating Records Into A Table Allows Selecting, Inserting And Updating Records Into A Table FOCUS To SQL Demystified – What IS SQL?
Copyright 2007, Information Builders. Slide 4 select t1.column1, sum(t1.column2) from tablename t1 where t1.columnname = 'value' group by t1.column1 order by t1.column1; Simple Select Statement: FOCUS To SQL DeMystified – What Is SQL?
Copyright 2007, Information Builders. Slide 5 SET TRACEOFF=ALL SET TRACEON=SQLAGGR//CLIENT SET TRACEON=STMTRACE//CLIENT SET TRACESTAMP=OFF SET TRACEUSER=ON SET XRETRIEVAL=OFF How To See The SQL Generated By FOCUS: FOCUS To SQL DeMystified – TRACE Settings
Copyright 2007, Information Builders. Slide 6 SQLAGGR Displays Data Adapter ‑ to ‑ RDBMS Aggregation And Join Analysis. Used Only For Focus Reporting Operations Such As Table, Graph, And Match File. If The Data Adapter Is Able To Pass All Join, Sort, And Aggregation Operations, The SQLAGGR Trace Is Not Populated. The Message "AGGREGATION DONE..." Appears. Formerly FSTRACE3. FOCUS To SQL Demystified – TRACE Settings
Copyright 2007, Information Builders. Slide 7 STMTRACE Records SQL SELECT Statements Generated By The Data Adapter For FOCUS Report Requests. Modify Procedures, Or Direct Sql Passthru Select Requests. It Also Records The SQL Data. Definition Language (DDL) Statements Generated By The Create File Command. Display The Trace Information Online. Store It In A File Or Sequential Data Set. The Data Adapter Terminates Its Generated SQL Select Statements With A Semicolon. You Can Submit Them To The RDBMS For Processing, Interactively Or In Batch. Use STMTRACE for: Debugging. Performance Tuning. Capturing SQL Data Definition And Data Manipulation Statements To Reuse. Formerly FSTRACE4. FOCUS To SQL DeMystified – TRACE Settings
Copyright 2007, Information Builders. Slide 8 MASTER: FILENAME=ORDERS, SUFFIX=SQLMSS, $ SEGMENT=ORDERS, SEGTYPE=S0, $ FIELDNAME=ORDERID, ALIAS=OrderID, USAGE=I11, ACTUAL=I4, FIELDTYPE=R,$ FIELDNAME=CUSTOMERID, ALIAS=CustomerID, USAGE=A5, ACTUAL=A5, MISSING=ON, $ FIELDNAME=EMPLOYEEID, ALIAS=EmployeeID, USAGE=I11, ACTUAL=I4, MISSING=ON, $ FIELDNAME=ORDERDATE, ALIAS=OrderDate, USAGE=HYYMDs, ACTUAL=HYYMDs, MISSING=ON, $ FIELDNAME=REQUIREDDATE, ALIAS=RequiredDate, USAGE=HYYMDs, ACTUAL=HYYMDs, MISSING=ON, $ FIELDNAME=SHIPPEDDATE, ALIAS=ShippedDate, USAGE=HYYMDs, ACTUAL=HYYMDs, MISSING=ON, $ FIELDNAME=SHIPVIA, ALIAS=ShipVia, USAGE=I11, ACTUAL=I4, MISSING=ON, $ FIELDNAME=FREIGHT, ALIAS=Freight, USAGE=P21.4, ACTUAL=P10, MISSING=ON, $ FIELDNAME=SHIPNAME, ALIAS=ShipName, USAGE=A40V, ACTUAL=A40V, MISSING=ON, $ FIELDNAME=SHIPADDRESS, ALIAS=ShipAddress, USAGE=A60V, ACTUAL=A60V, MISSING=ON, $ FIELDNAME=SHIPCITY, ALIAS=ShipCity, USAGE=A15V, ACTUAL=A15V, MISSING=ON, $ FIELDNAME=SHIPREGION, ALIAS=ShipRegion, USAGE=A15V, ACTUAL=A15V, MISSING=ON, $ FIELDNAME=SHIPPOSTALCODE, ALIAS=ShipPostalCode, USAGE=A10V, ACTUAL=A10V, MISSING=ON, $ FIELDNAME=SHIPCOUNTRY, ALIAS=ShipCountry, USAGE=A15V, ACTUAL=A15V, MISSING=ON, $ Northwind Orders Table ACCESS: SEGNAME=ORDERS, TABLENAME=Northwind.dbo.Orders, CONNECTION=CON01, KEYS=1, $ FOCUS To SQL DeMystified
Copyright 2007, Information Builders. Slide 9 TABLE FILE ORDERS PRINT ORDERID CUSTOMERID EMPLOYEEID ORDERDATE END FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION IS NOT APPLICABLE TO THE VERB USED SELECT T1."OrderID",T1."CustomerID",T1."EmployeeID", T1."OrderDate" FROM Northwind.dbo.Orders T1;...RETRIEVAL KILLED 0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0 FOCUS To SQL DeMystified – PRINT
Copyright 2007, Information Builders. Slide 10 TABLE FILE ORDERS PRINT ORDERID CUSTOMERID ORDERDATE BY EMPLOYEEID END FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION IS NOT APPLICABLE TO THE VERB USED SELECT T1."OrderID",T1."CustomerID",T1."EmployeeID", T1."OrderDate" FROM Northwind.dbo.Orders T1 ORDER BY T1."EmployeeID";...RETRIEVAL KILLED 0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0 FOCUS To SQL DeMystified – Sorting
Copyright 2007, Information Builders. Slide 11 Master File: FILENAME=ORDER_DETAILS, SUFFIX=SQLMSS, $ SEGMENT=ORDER_DETAILS, SEGTYPE=S0, $ FIELDNAME=ORDERID, ALIAS=OrderID, USAGE=I11, ACTUAL=I4, $ FIELDNAME=PRODUCTID, ALIAS=ProductID, USAGE=I11, ACTUAL=I4, $ FIELDNAME=UNITPRICE, ALIAS=UnitPrice, USAGE=P21.4, ACTUAL=P10, $ FIELDNAME=QUANTITY, ALIAS=Quantity, USAGE=I6, ACTUAL=I2, $ FIELDNAME=DISCOUNT, ALIAS=Discount, USAGE=D20.2, ACTUAL=D8, $ Access File: SEGNAME=ORDER_DETAILS, TABLENAME=Northwind.dbo."Order Details", CONNECTION=CON01, KEYS=2, $ FOCUS To SQL DeMystified
Copyright 2007, Information Builders. Slide 12 TABLE FILE ORDER_DETAILS SUM UNITPRICE QUANTITY BY ORDERID END FOC AGGREGATION DONE BUT MAY PRODUCE INCONSISTENT RESULTS FOC OVERFLOW MAY OCCUR WHEN SUMMING AN I2 FIELD WITH USAGE I, D OR P SELECT T1."OrderID", SUM(T1."UnitPrice"), SUM(T1."Quantity") FROM Northwind.dbo."Order Details" T1 GROUP BY T1."OrderID" ORDER BY T1."OrderID"; FOCUS To SQL DeMystified – SUM
Copyright 2007, Information Builders. Slide 13 FOC AGGREGATION DONE BUT MAY PRODUCE INCONSISTENT RESULTS FOC OVERFLOW MAY OCCUR WHEN SUMMING AN I2 FIELD WITH USAGE I, D OR P SELECT T1."OrderID", SUM(T1."UnitPrice"), SUM(T1."Quantity") FROM Northwind.dbo."Order Details" T1 GROUP BY T1."OrderID" ORDER BY T1."OrderID"; ? 2589 (FOC2589) AGGREGATION DONE BUT MAY PRODUCE INCONSISTENT RESULTS %1%2%3%4 This is the first line of the Interface FSTRACE3 output that is generated when RDBMS aggregation has been performed, but may produce different re- sults than FOCUS would have if optimization had been disabled and FOCUS had managed the JOINs and aggregation. Examine report results carefully. FOCUS To SQL DeMystified – SUM
Copyright 2007, Information Builders. Slide 14 TABLE FILE ORDER_DETAILS SUM UNITPRICE QUANTITY COMPUTE TTLPRICE/D12.2=UNITPRICE * QUANTITY; BY ORDERID END FOC AGGREGATION DONE BUT MAY PRODUCE INCONSISTENT RESULTS FOC OVERFLOW MAY OCCUR WHEN SUMMING AN I2 FIELD WITH USAGE I, D OR P SELECT T1."OrderID", SUM(T1."UnitPrice"), SUM(T1."Quantity") FROM Northwind.dbo."Order Details" T1 GROUP BY T1."OrderID" ORDER BY T1."OrderID"; FOCUS To SQL DeMystified – COMPUTE
Copyright 2007, Information Builders. Slide 15 DEFINE FILE ORDER_DETAILS TTLPRICE/D12.2=UNITPRICE * QUANTITY; END TABLE FILE ORDER_DETAILS SUM UNITPRICE QUANTITY TTLPRICE BY ORDERID END FOC AGGREGATION DONE BUT MAY PRODUCE INCONSISTENT RESULTS FOC OVERFLOW MAY OCCUR WHEN SUMMING AN I2 FIELD WITH USAGE I, D OR P SELECT T1."OrderID", SUM(T1."UnitPrice"), SUM(T1."Quantity"), SUM((T1."UnitPrice" * T1."Quantity")) FROM Northwind.dbo."Order Details" T1 GROUP BY T1."OrderID" ORDER BY T1."OrderID"; FOCUS To SQL DeMystified – DEFINE
Copyright 2007, Information Builders. Slide 16 DEFINE FILE ORDER_DETAILS TTLPRICE/D12.2=UNITPRICE * QUANTITY; COSTFLAG/A10=IF TTLPRICE GT THEN 'HIGH' ELSE IF TTLPRICE GT THEN 'MEDIUM' ELSE 'LOW'; END TABLE FILE ORDER_DETAILS SUM UNITPRICE QUANTITY TTLPRICE BY ORDERID WHERE COSTFLAG EQ 'HIGH' END SELECT T1."OrderID", SUM(T1."UnitPrice"), SUM(T1."Quantity"), SUM((T1."UnitPrice" * T1."Quantity")) FROM Northwind.dbo."Order Details" T1 WHERE ((CASE WHEN ((T1."UnitPrice" * T1."Quantity") > 5000) THEN 'HIGH' WHEN ((T1."UnitPrice" * T1."Quantity") > 1000) THEN 'MEDIUM' ELSE 'LOW' END) = 'HIGH') GROUP BY T1."OrderID" ORDER BY T1."OrderID"; FOCUS To SQL DeMystified – DEFINE
Copyright 2007, Information Builders. Slide 17 SQL engine ? (FOC1450) CURRENT SQLMSS INTERFACE SETTINGS ARE : (FOC1656) DEFAULT SERVER NAME - : CON01 cp01211dt1\dt1_sql (FOC1502) USERID AND PASSWORD ARE - : (FOC1758) CURRENT ISOLATION LEVEL IS - : RC (FOC1496) AUTODISCONNECT OPTION IS - : ON FIN (FOC1499) AUTOCOMMIT OPTION IS - : ON COMMAND (FOC1491) FETCH BUFFERING FACTOR - : 100 (FOC1755) CURSORS TYPE IS - : SERVER (FOC1723) TRANSACTION MODE IS - : LOCAL (FOC1441) WRITE FUNCTIONALITY IS - : ON (FOC1445) OPTIMIZATION OPTION IS - : ON (FOC1763) IF-THEN-ELSE OPTIMIZATION IS - : OFF (FOC1709) NCHAR OPTION IS - : SBCS FOCUS To SQL DeMystified – Settings
Copyright 2007, Information Builders. Slide 18 SQL SQLMSS SET OPTIFTHENELSE ON DEFINE FILE ORDER_DETAILS TTLPRICE/D12.2=UNITPRICE * QUANTITY; COSTFLAG/A10=IF TTLPRICE GT THEN 'HIGH' ELSE IF TTLPRICE GT THEN 'MEDIUM' ELSE 'LOW'; END TABLE FILE ORDER_DETAILS SUM UNITPRICE QUANTITY TTLPRICE BY ORDERID WHERE COSTFLAG EQ 'HIGH' END SELECT T1."OrderID", SUM(T1."UnitPrice"), SUM(T1."Quantity"), SUM((T1."UnitPrice" * T1."Quantity")) FROM Northwind.dbo."Order Details" T1 WHERE ((((T1."UnitPrice" * T1."Quantity") > 5000))) GROUP BY T1."OrderID" ORDER BY T1."OrderID"; FOCUS To SQL DeMystified – OPTIFTHENELSE
Copyright 2007, Information Builders. Slide 19 Type of JOINS INNER FULL LEFT OUTER FOCUS To SQL DeMystified – JOINs
Copyright 2007, Information Builders. Slide 20 MASTER FILE: FILENAME=EMPLOYEETERRITORIES, SUFFIX=SQLMSS, $ SEGMENT=EMPLOYEETERRITORIES, SEGTYPE=S0, $ FIELDNAME=EMPLOYEEID, ALIAS=EmployeeID, USAGE=I11, ACTUAL=I4, $ FIELDNAME=TERRITORYID, ALIAS=TerritoryID, USAGE=A20V, ACTUAL=A20V, $ MASTER FILE: FILENAME=TERRITORIES, SUFFIX=SQLMSS, $ SEGMENT=TERRITORIES, SEGTYPE=S0, $ FIELDNAME=TERRITORYID, ALIAS=TerritoryID, USAGE=A20V, ACTUAL=A20V, $ FIELDNAME=TERRITORYDESCRIPTION, ALIAS=TerritoryDescription, USAGE=A50, ACTUAL=A50, $ FIELDNAME=REGIONID, ALIAS=RegionID, USAGE=I11, ACTUAL=I4, $ FOCUS To SQL DeMystified – JOINs
Copyright 2007, Information Builders. Slide 21 JOIN INNER TERRITORYID IN EMPLOYEETERRITORIES TO TERRITORYID IN TERRITORIES AS J1 TABLE FILE EMPLOYEETERRITORIES PRINT TERRITORYDESCRIPTION BY EMPLOYEEID BY TERRITORYID END FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION IS NOT APPLICABLE TO THE VERB USED SELECT T1."EmployeeID",T1."TerritoryID", T2."TerritoryDescription" FROM Northwind.dbo.EmployeeTerritories T1,Northwind.dbo.Territories T2 WHERE (T2."TerritoryID" = T1."TerritoryID") ORDER BY T1."EmployeeID",T1."TerritoryID"; FOCUS To SQL DeMystified – INNER JOINs
Copyright 2007, Information Builders. Slide 22 JOIN LEFT_OUTER TERRITORYID IN EMPLOYEETERRITORIES TO TERRITORYID IN TERRITORIES AS J1 END TABLE FILE EMPLOYEETERRITORIES PRINT TERRITORYDESCRIPTION BY EMPLOYEEID BY TERRITORYID END FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION IS NOT APPLICABLE TO THE VERB USED SELECT T1."EmployeeID",T1."TerritoryID",T2."TerritoryID", T2."TerritoryDescription" FROM ( Northwind.dbo.EmployeeTerritories T1 LEFT OUTER JOIN Northwind.dbo.Territories T2 ON T2."TerritoryID" = T1."TerritoryID" ) ORDER BY T1."EmployeeID",T1."TerritoryID"; FOCUS To SQL DeMystified – LEFT OUTER JOIN
Copyright 2007, Information Builders. Slide 23 TABLE FILE EMPLOYEETERRITORIES PRINT EMPLOYEEID TERRITORYID ON TABLE HOLD END JOIN TERRITORYID IN HOLD TO TERRITORYID IN TERRITORIES AS J1 TABLE FILE HOLD PRINT TERRITORYDESCRIPTION BY EMPLOYEEID BY TERRITORYID END FOCUS To SQL DeMystified – JOIN from HOLD
Copyright 2007, Information Builders. Slide 24 FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION IS NOT APPLICABLE TO THE VERB USED SELECT T1."EmployeeID",T1."TerritoryID" FROM Northwind.dbo.EmployeeTerritories T1;...RETRIEVAL KILLED 0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0 TABLE FILE EMPLOYEETERRITORIES PRINT EMPLOYEEID TERRITORYID ON TABLE HOLD END JOIN TERRITORYID IN HOLD TO TERRITORYID IN TERRITORIES AS J1 TABLE FILE HOLD PRINT TERRITORYDESCRIPTION BY EMPLOYEEID BY TERRITORYID END FOCUS To SQL DeMystified – JOIN from HOLD
Copyright 2007, Information Builders. Slide 25 TABLE FILE EMPLOYEETERRITORIES PRINT EMPLOYEEID TERRITORYID ON TABLE HOLD END FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC NON-SQL SEGMENT IN HIERARCHY (OTHER INTERFACE PRESENT) SELECT T2."TerritoryDescription" FROM Northwind.dbo.Territories T2 WHERE (T2."TerritoryID" = ?);...RETRIEVAL KILLED 0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0 JOIN TERRITORYID IN HOLD TO TERRITORYID IN TERRITORIES AS J1 TABLE FILE HOLD PRINT TERRITORYDESCRIPTION BY EMPLOYEEID BY TERRITORYID END FOCUS To SQL DeMystified – JOIN from HOLD
Copyright 2007, Information Builders. Slide 26 DEFINE FILE ORDER_DETAILS QTRDEF/P10.3=QUANTITY / 4; END TABLE FILE ORDER_DETAILS SUM QUANTITY QTRDEF COMPUTE QTRCOMP/P10.3=QUANTITY / 4; BY ORDERID WHERE ORDERID LE END FOC AGGREGATION DONE BUT MAY PRODUCE INCONSISTENT RESULTS FOC OVERFLOW MAY OCCUR WHEN SUMMING AN I2 FIELD WITH USAGE I, D OR P SELECT T1."OrderID", SUM(T1."Quantity"), SUM((T1."Quantity" / 4)) FROM Northwind.dbo."Order Details" T1 WHERE (T1."OrderID" <= 10250) GROUP BY T1."OrderID" ORDER BY T1."OrderID"; 0 NUMBER OF RECORDS IN TABLE= 3 LINES= 3 ORDERID QUANTITY QTRDEF QTRCOMP FOCUS To SQL DeMystified – INTEGER Arithmetic
Copyright 2007, Information Builders. Slide 27 DEFINE FILE ORDER_DETAILS QTRDEF/P10.3=QUANTITY / 4; END TABLE FILE ORDER_DETAILS SUM QUANTITY QTRDEF COMPUTE QTRCOMP/P10.3=QUANTITY / 4; BY ORDERID SUM QUANTITY QTRDEF BY ORDERID BY PRODUCTID WHERE ORDERID LE END ORDERID QUANTITY QTRDEF QTRCOMP PRODUCTID QUANTITY QTRDEF FOCUS To SQL DeMystified – INTEGER Arithmetic
Copyright 2007, Information Builders. Slide 28 SQL SQLMSS SET OPT NOAGGR DEFINE FILE ORDER_DETAILS QTRDEF/P10.3=QUANTITY / 4; END TABLE FILE ORDER_DETAILS SUM QUANTITY QTRDEF COMPUTE QTRCOMP/P10.3=QUANTITY / 4; BY ORDERID WHERE ORDERID LE END FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION DISABLED BY USER SELECT T1."OrderID",T1."Quantity" FROM Northwind.dbo."Order Details" T1 WHERE (T1."OrderID" <= 10250) ORDER BY T1."OrderID"; ORDERID QUANTITY QTRDEF QTRCOMP FOCUS To SQL DeMystified – INTEGER Arithmetic
Copyright 2007, Information Builders. Slide 29 FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION DISABLED BY USER SELECT T1."OrderID",T1."Quantity" FROM Northwind.dbo."Order Details" T1 WHERE (T1."OrderID" <= 10250) ORDER BY T1."OrderID"; FOC AGGREGATION DONE BUT MAY PRODUCE INCONSISTENT RESULTS FOC OVERFLOW MAY OCCUR WHEN SUMMING AN I2 FIELD WITH USAGE I, D OR P SELECT T1."OrderID", SUM(T1."Quantity"), SUM((T1."Quantity" / 4)) FROM Northwind.dbo."Order Details" T1 WHERE (T1."OrderID" <= 10250) GROUP BY T1."OrderID" ORDER BY T1."OrderID"; SQL engine SET OPT AGGR SQL engine SET OPT NOAGGR FOCUS To SQL DeMystified – SQLAGGR
Copyright 2007, Information Builders. Slide 30 Master File: FILENAME=ORDERS, SUFFIX=SQLMSS, $ SEGMENT=ORDERS, SEGTYPE=S0, $ FIELDNAME=ORDERID, ALIAS=OrderID, USAGE=I11, ACTUAL=I4, FIELDTYPE=R, $ FIELDNAME=CUSTOMERID, ALIAS=CustomerID, USAGE=A5, ACTUAL=A5, MISSING=ON, $ FIELDNAME=EMPLOYEEID, ALIAS=EmployeeID, USAGE=I11, ACTUAL=I4, MISSING=ON, $ FIELDNAME=ORDERDATE, ALIAS=OrderDate, USAGE=HYYMDs, ACTUAL=HYYMDs, MISSING=ON, $ FIELDNAME=REQUIREDDATE, ALIAS=RequiredDate, USAGE=HYYMDs, ACTUAL=HYYMDs, MISSING=ON, $ FIELDNAME=SHIPPEDDATE, ALIAS=ShippedDate, USAGE=HYYMDs, ACTUAL=HYYMDs, MISSING=ON, $ FIELDNAME=SHIPVIA, ALIAS=ShipVia, USAGE=I11, ACTUAL=I4, MISSING=ON, $ FIELDNAME=FREIGHT, ALIAS=Freight, USAGE=P21.4, ACTUAL=P10, MISSING=ON, $ FIELDNAME=SHIPNAME, ALIAS=ShipName, USAGE=A40V, ACTUAL=A40V, MISSING=ON, $ FIELDNAME=SHIPADDRESS, ALIAS=ShipAddress, USAGE=A60V, ACTUAL=A60V, MISSING=ON, $ FIELDNAME=SHIPCITY, ALIAS=ShipCity, USAGE=A15V, ACTUAL=A15V, MISSING=ON, $ FIELDNAME=SHIPREGION, ALIAS=ShipRegion, USAGE=A15V, ACTUAL=A15V, MISSING=ON, $ FIELDNAME=SHIPPOSTALCODE, ALIAS=ShipPostalCode, USAGE=A10V, ACTUAL=A10V, MISSING=ON, $ FIELDNAME=SHIPCOUNTRY, ALIAS=ShipCountry, USAGE=A15V, ACTUAL=A15V, MISSING=ON, $ Northwind Orders table Access File: SEGNAME=ORDERS, TABLENAME=Northwind.dbo.Orders, CONNECTION=CON01, KEYS=1, $ FOCUS To SQL DeMystified – DATE Conditions
Copyright 2007, Information Builders. Slide 31 DEFINE FILE ORDERS ORDERDT/YYMD=HDATE(ORDERDATE,'YYMD'); END TABLE FILE ORDERS PRINT ORDERID EMPLOYEEID CUSTOMERID ORDERDATE WHERE ORDERDT EQ '1996/07/08' END FOC FOCUS IF/WHERE TEST CANNOT BE PASSED TO SQL : ORDERDT FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION IS NOT APPLICABLE TO THE VERB USED SELECT T1."OrderID",T1."CustomerID",T1."EmployeeID", T1."OrderDate" FROM Northwind.dbo.Orders T1; ORDERID EMPLOYEEID CUSTOMERID ORDERDATE HANAR 1996/07/08 00:00: VICTE 1996/07/08 00:00: FOCUS To SQL DeMystified – DATE Conditions
Copyright 2007, Information Builders. Slide 32 ? STAT STATISTICS OF LAST COMMAND RECORDS = 2 SEGS DELTD = 0 LINES = 2 NOMATCH = 0 BASEIO = 0 DUPLICATES = 0 SORTIO = 0 FORMAT ERRORS = 0 SORT PAGES = 0 INVALID CONDTS = 0 READS = 830 OTHER REJECTS = 0 TRANSACTIONS = 0 CACHE READS = 0 ACCEPTED = 0 MERGES = 0 SEGS INPUT = 0 SORT STRINGS = 0 SEGS CHNGD = 0 INDEXIO = 0 INTERNAL MATRIX CREATED: YES AUTOINDEX USED: NO SORT USED: SQL AUTOPATH USED: NO AGGREGATION BY EXT.SORT: NO HOLD FROM EXTERNAL SORT: NO FOCUS To SQL DeMystified – Report Statistics
Copyright 2007, Information Builders. Slide 33 Master File: FILENAME=ORDERS, SUFFIX=SQLMSS, $ SEGMENT=ORDERS, SEGTYPE=S0, $ FIELDNAME=ORDERID, ALIAS=OrderID, USAGE=I11, ACTUAL=I4, FIELDTYPE=R, $ FIELDNAME=CUSTOMERID, ALIAS=CustomerID, USAGE=A5, ACTUAL=A5, MISSING=ON, $ FIELDNAME=EMPLOYEEID, ALIAS=EmployeeID, USAGE=I11, ACTUAL=I4, MISSING=ON, $ FIELDNAME=ORDERDATE, ALIAS=OrderDate, USAGE=HYYMDs, ACTUAL=HYYMDs, MISSING=ON, $ FIELDNAME=ORDERDT, ALIAS=OrderDate, USAGE=YYMD, ACTUAL=DATE, MISSING=ON, $ Northwind Orders table Access File: SEGNAME=ORDERS, TABLENAME=Northwind.dbo.Orders, CONNECTION=CON01, KEYS=1, $ FOCUS To SQL DeMystified – DATE Conditions
Copyright 2007, Information Builders. Slide 34 TABLE FILE ORDERS PRINT ORDERID EMPLOYEEID CUSTOMERID ORDERDATE WHERE ORDERDT EQ '1996/07/08' END FOC AGGREGATION NOT DONE FOR THE FOLLOWING REASON: FOC AGGREGATION IS NOT APPLICABLE TO THE VERB USED SELECT T1."OrderID",T1."CustomerID",T1."EmployeeID", T1."OrderDate",T1."OrderDate" FROM Northwind.dbo.Orders T1 WHERE (T1."OrderDate" = ' '); ORDERID EMPLOYEEID CUSTOMERID ORDERDATE HANAR 1996/07/08 00:00: VICTE 1996/07/08 00:00: FOCUS To SQL DeMystified – DATE Conditions
Copyright 2007, Information Builders. Slide 35 ? STAT STATISTICS OF LAST COMMAND RECORDS = 2 SEGS DELTD = 0 LINES = 2 NOMATCH = 0 BASEIO = 0 DUPLICATES = 0 SORTIO = 0 FORMAT ERRORS = 0 SORT PAGES = 0 INVALID CONDTS = 0 READS = 2 OTHER REJECTS = 0 TRANSACTIONS = 0 CACHE READS = 0 ACCEPTED = 0 MERGES = 0 SEGS INPUT = 0 SORT STRINGS = 0 SEGS CHNGD = 0 INDEXIO = 0 INTERNAL MATRIX CREATED: YES AUTOINDEX USED: NO SORT USED: SQL AUTOPATH USED: NO AGGREGATION BY EXT.SORT: NO HOLD FROM EXTERNAL SORT: NO FOCUS To SQL DeMystified – Report Statistics
Copyright 2007, Information Builders. Slide 36 FOCUS To SQL DeMystified - Review n SQL Overview n SQL Traces n Verb Objects n Sorting n Record Selection n Defining Fields n Combining Files
Copyright 2007, Information Builders. Slide 37 Thanks for Coming FOCUS To SQL DeMystified – Questions??