Download Tutorial Reviews Textbook Glossary
Free Download
White Papers
SQL-99 Textbook
Company Info

SQL Tutorial

  • SQL Books
  • DBMS Books
  • JDBC Books
  • ADO Books
  • MySQL Books
  • Sybase Books
  • Informix Books

    Get a free copy of our DBMS

    Order our book

    The comments which follow are merely an errata page about the sample chapter on the publisher's site: The notes were written on October 22 2000, one month before publication date. The chapter is clearly labelled "beta" so review is inappropriate. We wrote to the publisher (O'Reilly). They didn't reply immediately, but the author has contacted us, has indicated that all the plaints have been addressed, and that he's happy with feedback. Therefore you will not see these items when you get the book yourself. Just think of this letter as an example of how we work when we look at SQL books.

    The chapter is about SQL functions. Each following note begins with an exact quotation from the chapter (inside ""s), and ends with our observations about the quotation (beginning with --). Notes are in chapter order.

    "Scalar functions operate against a single value and return a single value based on the input value. "
    -- This would only be true of a monadic scalar function. But the chapter has already mentioned CURRENT_TIME, a scalar function that has no arguments.

    "Aggregate functions return a single value based upon a set of other values. If used in the item list of a SELECT statement, the SELECT must have a GROUP BY clause."
    -- No. The statement "SELECT AVG(column1) FROM t;" is legal and has no GROUP BY clause. The rules are somewhat more complex than as stated.

    "SELECT type, AVG( ytd_sales ) AS 'average_ytd_sales' FROM titles " GROUP BY type;
    -- This is one of several examples that appear to be using a single quote around an identifier. Double quotes would be correct, or no quotes.

    "SELECT COUNT(DISTINCT country) 'Count of Countries' FROM publishers GO"
    -- The word GO would be okay in a vendor-specific example, but not here.

    "MIN(expression) and MAX(expression) find the minimum and maximum value (string, date, or numeric)..."
    -- That's not all the types. Perhaps for "date" we should say "datetime".

    "[String function category] Performs operations on char and varchar values and returns a string or numeric value."
    -- Perhaps CLOBs aren't mentioned for some reason that's explained in another chapter?

    "PostgreSQL supports USER, as defined is defined in SQL99 as a synonym for CURRENT_USER."
    -- Just a grammar error.

    "[OCTET_LENGTH] This value is the same as BIT_LENTH / 8."
    -- Just a spelling error.

    "PostgreSQL has the synonymous a function called TEXTPOS"
    -- Just a typo.

    "Some string functions are didactic, indicating that they operate on two or more strings at once. SQL99 supports these string functions:"
    -- Howler! Perhaps some spell checker corrected the word "dyadic" to "didactic"? Even that wouldn't fit, since dyadic functions have only two arguments, not two or more.

    "SQL99 Syntax [is] CONCATENATE('string1' || 'string2')"
    -- This is not SQL99 syntax. All that's needed is 'string1'||'string2'.

    "Thus translate might be used to translate a value from the English character set to a Swedish or French character set."
    -- An unlikely example, since nowadays English and Swedish and French all use the same character set. Try a more exotic tongue.

    "Instead, it converts any occurance of ..." [sic]
    -- Guess I was wrong -- there has been no use of a spell checker.

    "SELECT LOWER('You Talkin To ME?'), UPPER('you talking to me?!'); [yields] you talking to me? YOU TALKIN TO ME?!"
    -- The statement would not produce this result, at least not quite.

    "SUBSTRING(extraction_string FROM starting_position [FOR length]) [COLLATE collation_name]"
    -- This syntax exposition has the right parenthesis in the wrong place. It should be at the end, after the COLLATE clause.

    "Microsoft SQL Server largely supports the SQL99 standard, except that it does not except the COLLATE clause."
    -- You don't mean "except" here, you mean "accept".

    "/* On MySQL */ SELECT SUBSTRING('Be vewy, vewy quiet',5); [yields] 'wy, vewy quiet''"
    -- In SQL99 the result would [yield] 'ewy, vewy quiet'' I believe there has been a miscount.

    "TRIM( [ [{LEADING | TRAILING | BOTH}] [removal_string] FROM ] target_string [COLLATE collation_name]"
    -- This time, there is a missing right parenthesis.

    "The COLLATE clause a forces the result set of the function into another preexisting collation set."
    -- Where does this extra word "a" keep coming from?

    "SELECT TRIM(LEADING '19' FROM '1976 AMC GREMLIN'); [yields] '76 AMC GREMLIN'"
    -- This statement is illegal in SQL99. In SQL99, the first argument must have character length = 1.

    "Table 4-7: Alphabetical Listing of Microsoft SQL Server-Specific Functions "
    -- ABS is not vendor-specific but SQL99 and should be in the regular numeric-function list. ACSII is usually spelled ASCII. In any case, I don't see why this and the following tables would exist in a general SQL book. So I stopped reading here.
    You can order SQL In A Nutshell from

    Copyright (c) 2000-2002 by Ocelot Computer Services Inc. All rights reserved.
    Return to Ocelot home page
    Send enquiries or suggestions to: