772 REFERENCES Other consortiums are: X/Open 1010 El Camino Real #380 Menlo Park, CA 94025 Phone: (415) 323-7992 NOTE: the SQL Access Group is now part of X/Open NIST Technology A-266 Gaithersberg, MD 20899 TPC Council c/o Shanley Public Relations 777 North First Street #600 San Jose, CA 95112-6113 Phone: (408) 295-8894 Object Management Group 492 Old Connecticut Path Framingham, MA 01701 Phone: (508) 820-4300 Web Sites Related to SQL The SQL home page is maintained by one of the X3H2 Committee members at: www.jjc.com/sql_stnd.html You can also get help with queries and technical stuff at: www.inquiry.com/techtips/thesqlpro/index.html Statistics The American Statistical Association has their material online and you can find many articles on the computation of various statistics. www.amstat.org/publications/tas/ www.amstat.org/publications/technometrics/ Temporal Databases 773 Chan, Tony F., Golub, Gene H., and LeVeque, Randall J. 1983. “Algo- rithms for Computing the Sample Variance: Analysis and Recommenda- tions. The American Statistician 37(3):242-247. ” Welford, B. P. 1962. “Note on a Method for Calculating Corrected Sums of Squares and Products.” Technometrics 4:419-420. Temporal Databases Date, Chris, Darwen, H., and Lorentzos, N.A. 2002. Temporal Data and the Relational Model. San Francisco, CA: Morgan Kaufmann. ISBN 1- 55860-855-9. Jensen, C. S. Clifford, J., Elmasri, R., Gadia, S. K., Hayes P., and Jajodia, S. (eds). 1994. “A Glossary of Temporal Database Concepts.”ACM SIG- MOD Record 23(1):52-64. Ozsoyoglu, G., and Snodgrass, R. T. 1995. “Temporal and Real-Time Databases: A Survey.” IEEE Transactions on Knowledge and Data Engineer- ing 7(4):513-532. Snodgrass, R. T. (ed.), Ahn, I., Ariav, G., Batory, D., Clifford, J., Dyreson, C.E., Elmasri, R., Grandi F., Jensen C. S., Kaefer W., Kline, N., Kulkarni, K., Leung, T. Y. C., Lorentzos, N., Roddick, J. F., Segev, A., Soo, M. D., and Sripada, S. M. 1995. The Temporal Query Language TSQL2. Norwell, MA: Kluwer Academic Publishers. Snodgrass, R. T., Boehlen, M. H., Jensen, C. S., and Steiner, A. 1996. Adding Valid Time to SQL/Temporal. Change proposal, ANSI X3H2-96- 501r2, ISO/IEC JTC 1/SC 21/WG 3 DBL-MAD-146r2. At ftp:// ftp.cs.arizona.edu/tsql/tsql2/sql3/mad146.pdf. ———. 1996. Adding Transaction Time to SQL/Temporal. Change pro- posal, ANSI X3H2-96-502r2, ISO/IEC JTC1/SC21/WG3 DBL MAD- 147r2. At ftp://ftp.cs.arizona.edu/tsql/tsql2/sql3/mad147.pdf. Snodgrass, R. T. and Jensen, C. 1999. Temporal Databases. San Fran- cisco, CA: Morgan Kaufmann. ISBN 1-558604-365-9. The book is out of print, but the material is available on the Univerity of Arizona Web site, under the account of Dr. Snodgrass. Tansel, A., Clifford, J., Gadia, S. K., Jajodia, S., Segev, A., and Snodgrass, R. T. (eds.). 1993. Temporal Databases: Theory, Design, and Implementa- tion. Database Systems and Applications Series. Redwood City, CA: Ben- jamin/Cummings Pub. Co. 774 REFERENCES Tsotras, V. J., and Kumar, A. 1996. “Temporal Database Bibliography Update.” ACM SIGMOD Record 25(1):41-51. Zaniolo, C. Ceri, S., Faloutsos, C., Snodgrass, R. T., Subrahmanian, V. S., and Zicari, R. 1997. Advanced Database Systems. San Francisco, CA: Mor- gan Kaufmann. New Citations Microsoft Research Technical Report: MSR-TR-95-51. 1995. “A Critique of ANSI SQL Isolation Levels” by Hal Berenson, Phil Bernstein, Jim Gray, Jim Melton, Elizabeth O’Neil, and Patrick O’Neil. Bose, R. C., and R. J. Nelson. A Sorting Problem. Journal of the ACM, vol. 9. Codd, E. F. 1990. The Relational Model for Database Management: Version 2. Reading, MA: Addison Wesley. Codd, E. F. 1979. “Extending the Database Relational Model to Capture More Meaning.” ACM Transactions on Database Systems. 4(4):397-434 Dijkstra, Edsger. 1968. Go To Statement Considered Harmful. Communi- cations of the ACM 11(3):147-148. Addresses old versus new JOIN syntax. Gonzales, Michael L. 2003. The IBM Data Warehouse. New York: Wiley. ———. 2004. “The SQL Language of OLAP.”Intelligent Enterprise (Sep- tember 18). Hegeman, Frédérick. 1993. “Sorting Networks,”The C/C++ User’s Journal (February). Knuth, Donald. The Art Of Computer Programming. vol. 3 Larsen, Sheryl. 1996. “Powerful SQL: Beyond the Basics.” DB2 Magazine (Winter). Article may be viewed online at www.db2mag.com/db_area/ archives/1996/q4/9601lar.shtml. Melton, Jim. 1998. Understanding SQL’s Stored Procedures. San Francisco, CA: Morgan Kaufmann. ISBN 1-55860-461-8. Moreau, Tom, and Ben-Gan, Itzik. 2001. Advanced Transact-SQL for SQL Server 2000. Berkeley, CA: Apress. ISBN 1-89311-582-8. Pascal, Fabian. 1988 OR 1998. “SQL Redundancy and DBMS Perfor- mance.” Database Programming and Design 1(12). The Unicode Consortium. 2003. The Unicode Standard, Version 4.0. Read- ing, MA: Addison-Wesley. ISBN 0-321-18578-1. New Citations 775 Watson, E. J. 1962. “Primitive Polynomials (Mod 2).” Mathematics of Computation 16:368-369. Zemke, Fred, Kulkami, Krishna, Witkowski, Andy, and Lyle, Bob. “Introduction to OLAP Functions.” ANSI document. Index % character, 263 _ character, 263 A ABS() function, 473 Access methods, 732–33 bit vector indexes, 733 hashed indexes, 733 indexed access, 732–33 sequential access, 732 ACID properties, 720–22 atomicity, 720–21 consistency, 721 durability, 722 isolation, 721–22 Active Online Catalog, 62 Acyclic graphs, 682 loading, 682 as nested sets, 695–97 See also Graphs Additive congruential method, 45–46 Addresses, physical, 39 Ad hoc queries, 742 Adjacency list model, 624–28 altering table, 628 complex constraints, 625–27 converting, to nested set model, 637–39 converting nested set model to, 635 defined, 624 procedural traversal, 627–28 See also Tree Adjacency matrix defined, 705 model, 705–6 AGE() function, 658, 667 Aggregate functions, 439–75 AND , 475 AVG() , 444–49 bitwise, 473–75 COUNT() , 440–43 defined, 439 extrema, 313–14, 449–65 functioning of, 439–40 functions inside, 348 GREATEST() , 117, 462–65 778 INDEX HAVING clause and, 429 LEAST() , 117, 202, 462–65 LIST() , 465–68 MAX() , 449–50 MIN() , 449–50 nesting, 431, 433, 434 OR , 474–75 OUTER JOINs and, 348–49 PRD() , 468–73 SELECT clause, 324 single-column, 546 SUM() , 107, 443–44 Aggregation aggregates, finding, 433 groups, 715–16 multilevel, in single query, 433 multiple levels, 431–35 Allocation blocks, 44 ALL predicate, 312, 313–14 converting to EXISTS predicate, 312 extrema functions and, 313–14 use of, 313 ALTER TABLE statement, 5, 7–8 ADD COLUMN clause, 8 ALTER COLUMN clause, 8 defined, 7 DROP COLUMN clause, 7 DROP CONSTRAINT clause, 8 syntax, 7 AND function, 475 ANY predicate, 312, 313 Approximate numeric values, 102–3 exponent, 102, 103 mantissa, 102–3 value, 103 ARCSIN() function, 202 Arithmetic four-function, 108–9 NULLs and, 109–10 Arrays, 575–89 1NF violation, 575 comparing, in table format, 587– 89 crosstabs and, 585 flattening tables into, 585–87 languages and, 575 matrix operations, 581–85 via named columns, 576–79 via subscript columns, 580–81 Artificial keys, 89 Ascending Order Algorithm, 360 Assertions, 30 creating, 26 dropping, 25 uniqueness constraints and, 31 uses, 25 At least (>=) operator, 235 At most (<=) operator, 235 Atomicity property, 720–21 Attributes constraint, 10 different names, 88 nonkey, 88 Attribute splitting avoiding, 31–34 forms, 31 rows, 33–34 tables, 31–33 Audit logs maintaining, 158–60 modifying, 164 querying, 160–64 triggers and, 158 updates, 158 utility, 160 Auxiliary function tables, 493–506 advantages, 497 interpolation with, 504–6 inverse, 495–504 Auxiliary tables, 477–507 calendar, 673–75 INDEX 779 defined, 477–85 global constants, 506–7 hierarchical, 490–91 inverse functions with, 495–504 lookup, 485–93 multiple parameter, 488–89 multiple translation, 487–88 OTLT, 491–93 range, 489–90 sequence, 477–85 setup form, 504 translation, 487 See also Tables Average deviation, 528 Averages across columns, 448–49 with empty groups, 446–48 values, 445 Average wait times, 660–61 AVG() function, 444–49 ALL keyword, 444 defined, 444 DISTINCT keyword, 444–45 in SELECT clause, 523 statistics and, 512 B BETWEEN predicate, 240, 273–75 avoiding, 285 defined, 273 indexing scheme choice, 275 interval end point, 278 programming tips, 274–75 results with empty sets, 274 results with NULL values, 274 searches with, 489 as two comparisons, 275 BIGINT numeric type, 102 Binary trees, 623 BIT data type, 104 Bitemporal tables, 164–67 defined, 164 history, 167 interpretation, 165 modifications, 165–66 transaction time, 166 transaction timestamps, 165 update, 165 See also Tables BIT_LENGTH() function, 173 Bit vector indexes, 733 Bitwise aggregate functions, 473–75 AND , 475 defined, 473 OR , 474–75 Boole, George, 190 Boolean expressions conversion algorithm, 418 in RDBMS, 418–19 Bose-Nelson sort, 94, 95, 98 Bound queries, 557 Boyce-Codd Normal Form (BCNF), 73–75 defined, 74 tables, 73–74 See also Normal forms BYTE data type, 104 C Calculated columns, 373 Calendar auxiliary table, 673–75 data, 675 forms, 674 with Julianized data columns, 567 See also Auxiliary tables Calendar(s) corrections, 120–21 Julian, 120 personal, 643–45 realign, 120 standards, 119–23 CASE expressions, 143, 144, 247–59, 471 advantage, 229 780 INDEX COALESCE() function, 251 crosstabs by, 545 defined, 247 derived tables and, 422 ELSE clause, 249, 250 GROUP BY query, 252–53 LIKE predicates and, 266–67 logical predicates, 253–57 for multiple aggregation levels, 434–35 nesting, 248 NULLIF() function, 251–52 ORDER BY clause and, 333–36 searched, 248 syntax, 247–48 THEN clause, 249 UPDATE statement, 228–30 WHEN clause, 248, 249, 250 CASE tools 3NF with, 78 formal methods implementation, 87 CAST() function, 107, 457, 657 CEILING() function, 117, 514–15 Celko’s first median, 514–16 Celko’s second median, 517–19 Celko’s third median, 522–26 Character data types, 169–83 CHAR() data type, 169 CHAR_LENGTH() function, 173 CHECK() constraints, 12–14, 489 applied to whole table, 26 in complex expressions, 12 CREATE DOMAIN statement, 52 defined, 12 denormalization and, 93 IN() predicate and, 295–96 predicates in, 254 use example, 12–13 use of, 28 WITH CHECK OPTION clause and, 388–89 Circular references, 15 Class hierarchy modeling, 34–36 CLOSE statement, 56 COALESCE() function, 39, 111–13, 194 in column sums, 448 defined, 111 defining, 251 example uses, 111–12 in NATURAL LEFT OUTER JOINs, 344 use of, 40, 111 COBOL, 2, 4, 124, 125 Codd, Dr. E.F., 36, 48, 50, 55, 61, 90, 359 Collation sequences, 169, 171 Colombian solution, 364–68 Columnar subqueries, 257 Columns averages across, 448–49 calculated, 373 computed, 72 constraints, 5, 10–17 data types, 5 definitions, 4, 9 grouping, 425–26, 435–36 IDENTITY, 37–38 indexes, 746 INTEGER, single, 203–4 list, viewing, 379 minimum/maximum values, 448 minimum requirements, 6 missing values, 187–89 multiple, data elements, 201–9 named, 576–79 names, 4–5, 5, 347 names, preserving, 593 order, 329 repeating, 67–68 INDEX 781 scalar expressions, 397 sequence, 549 SMALLINT, 205 sorting, 329 subscript, 580–81 sum of, 448 translated, 373–74 UNION of, 595–96 UNIQUE, 314 VARCHAR(15), single, 203 See also Tables Common Table Expressions (CTEs), 397 paths with, 697–705 simplification, 705 Comparison operators, 235–40 data types, 235 defined, 23 symbols/meanings, 235 Comparisons array, 587–89 row, 238–40 row expression, 289 VARCHAR strings, 450 Complex constraints, 625–27 Comprehensive Data Sublanguage Rule, 62–63 Computed columns grouping on, 435–36 transitive dependency, 72 See also Columns Concatenation, 657 Concurrency control, 43, 722–26 five phenomena, 722–24 isolation levels, 724–26 logical, 729 optimistic, 727–29 pessimistic, 726–27 CONNECT TO statement, 719–20 Consistency property, 721 Constraints attributes, 10 CHECK(), 12–14 column, 5, 10–17 complex, 625–27 CREATE ASSERTION, 25 deferrable, 10, 17 defined, 5, 10 DRI, 17 FOREIGN KEY, 21 grouping, 461 integrity, 63, 631 names, 10 nonsequenced, 137 NOT NULL, 11–12 PRIMARY KEY, 14 REFERENCES, 15–17, 36 schema-level, 25–29 sequenced, 134, 137 setting, 11 UNIQUE, 14 uniqueness, 31 Containment determination, 602 property, 634–35 CONTAINS operator, 602, 612–18 Contiguous events boundary dates, 654 missing times, 652–58 Continuous time series, 648–52 Coordinated Universal Time (CUT), 122 Correlated subqueries, 310 calculation, 325 defined, 324 GROUP BY clause and, 456 with MAX() function, 451 in SELECT statement, 324–26, 436 See also Subqueries Cost-based optimizers, 731 Counter ranges, 40 . Advanced Transact -SQL for SQL Server 2000. Berkeley, CA: Apress. ISBN 1-8 931 1-5 8 2-8 . Pascal, Fabian. 1988 OR 1998. SQL Redundancy and DBMS Perfor- mance.” Database Programming and Design 1(12) ftp://ftp.cs.arizona.edu/tsql/tsql2 /sql3 /mad147 .pdf. Snodgrass, R. T. and Jensen, C. 1999. Temporal Databases. San Fran- cisco, CA: Morgan Kaufmann. ISBN 1-5 5860 4-3 6 5-9 . The book is out of print, but the material is. ftp:// ftp.cs.arizona.edu/tsql/tsql2 /sql3 /mad146 .pdf. ———. 1996. Adding Transaction Time to SQL/ Temporal. Change pro- posal, ANSI X3H 2-9 6-5 02r2, ISO/IEC JTC1/SC21/WG3 DBL MAD- 147r2. At ftp://ftp.cs.arizona.edu/tsql/tsql2 /sql3 /mad147 .pdf. Snodgrass,