SQL in a Nutshell

( 1 )

Overview

SQL (Structured Query Language) is a standardized query language for requesting information from a database. Historically, SQL has been the choice for database management systems running on minicomputers and mainframes. Increasingly, however, SQL is being adapted to PC database systems because it supports distributed databases—databases that are spread out over several computer systems, so that several users on a local-area network can access the same database simultaneously. Although there are different dialects...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (31) from $1.99   
  • New (3) from $16.36   
  • Used (28) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$16.36
Seller since 2009

Feedback rating:

(847)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
1565927443 *BRAND NEW* Ships Same Day or Next!

Ships from: Springfield, VA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$38.00
Seller since 2009

Feedback rating:

(59)

Condition: New
New New as pictured-clean, excellent condition-Ships from legendary independent online bookstore in Murrieta, California. Thousands of satisfied customers. We ship promptly and ... Worldwide. We work hard to earn your confidence. Orders are fully guaranteed, includes free Tracking and Delivery Confirmation and normally ships the same business day. We use bubble wrap lined heavy Kraft envelopes. Reliable customer service and no-hassle return policy. Why pay more? Read more Show Less

Ships from: Diamond Bar, CA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$50.00
Seller since 2014

Feedback rating:

(136)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
SQL in a Nutshell

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$19.99
BN.com price
(Save 44%)$35.99 List Price
This digital version does not exactly match the physical book displayed here.

Overview

SQL (Structured Query Language) is a standardized query language for requesting information from a database. Historically, SQL has been the choice for database management systems running on minicomputers and mainframes. Increasingly, however, SQL is being adapted to PC database systems because it supports distributed databases—databases that are spread out over several computer systems, so that several users on a local-area network can access the same database simultaneously. Although there are different dialects of SQL, it is the closest thing to a standard query language that currently exists.

SQL in a Nutshell is a practical and useful command reference to the latest release of the Structured Query Language (SQL99), helping readers learn how their favorite database product supports any standard SQL command. This book presents each of the SQL commands and describes its use in both commercial (Microsoft SQL Server 2000 and Oracle 8i) and open source (MySQL, PostgreSQL 7.0) implementations. Each command reference includes the command syntax (by vendor, if the syntax differs across implementations), a description, and informative examples that illustrate important concepts and uses.

SQL in a Nutshell is more than a convenient reference guide for experienced SQL programmers, analysts, and database administrators. It's also a great learning resource for novice and auxiliary SQL users such as system administrators, users of packaged client/server products, and consultants who need to be familiar with the various SQL dialects across many platforms.

About the Authors:
Kevin Kline serves as the lead information architect for shared information services at Deloitte & Touche LLP. When he's not pulling out his hair over work issues, he likes to spend time with his wife and kids, garden, restore his '66 Chevy truck, and play classical guitar. After finishing SQL in a Nutshell, Kevin doesn't want to look at a computer outside of work hours for months! Kevin is the author of Transact-SQL Programming for O'Reilly & Associates. He is also the co-author of Professional SQL Server 6.5 Admin (WROX Press) and author of Oracle CDE: Reference and User's Guide (Butterworth-Heinemann).

Other than being Kevin's brother, Daniel Kline is an assistant professor of English at the University of Alaska, Anchorage, where he specializes in medieval literature, literary and cultural theory, and computer assisted pedagogy. Dan's technical specialty is in HTML and web applications for higher education.

Read More Show Less

Product Details

  • ISBN-13: 9781565927445
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 12/25/2000
  • Series: In a Nutshell (O'Reilly) Series
  • Edition description: Older Edition
  • Pages: 224
  • Product dimensions: 5.97 (w) x 8.93 (h) x 0.54 (d)

Meet the Author

Kevin Kline is the team leader for Information Architecture within Shared Information Services at Deloitte & Touche LLP. Kevin and his team perform data and infrastructure architecture in support of major knowledge management and transaction processing systems for Deloitte's Client Service Technology organization. Kevin is also the author of Transact-SQL Programming and numerous magazine articles on Microsoft SQL Server. When he's not pulling his hair out over work issues, Kevin likes to romance his wife, play with his three kids, tinker with his '66 Chevy pickup, and garden.

Other than being Kevin's brother, Daniel Kline is an Assistant Professor of English at the University of Alaska, Anchorage, where he specializes in medieval literature, literary and cultural theory, and computer-assisted pedagogy. He completed his Ph.D. at Indiana University, Bloomington, and in addition to numerous scholarly presentations, Dan recently has published academic essays in Literary and Linguistic Computing, Philological Quarterly, Chaucer Review, and Essays in Medieval Studies. When he's not spending time with his wife and two boys, Dan frets over his pet project, the Electronic Canterbury Tales. Dan can be reached at afdtk@uaa.alaska.edu.

Read More Show Less

Read an Excerpt

Chapter 4: SQL Functions

A function is a special type of command word in the SQL99 command set. In effect, functions are one-word commands that return a single value. The value of a function can be determined by input parameters, as with a function that averages a list of database values. But many functions do not use any type of input parameter, such as the function that returns the current system time, CURRENT_TIME.

The SQL99 standard supports a number of useful functions. This chapter covers those functions, providing detailed descriptions and examples. In addition, each database vendor maintains a long list of their own internal functions that are outside of the scope of the SQL standard. Lists and descriptions are provided for each database implementation's internal functions.

In addition, most database vendors support the ability to create user-defined functions (UDF). For more information on UDFs, refer to the CREATE FUNCTION command in Chapter 3, SQL Statements Command Reference.

Deterministic and Nondeterministic Functions

Functions can be either deterministic or nondeterministic. A deterministic function always returns the same results if given the same input values. A nondeterministic function returns different results every time it is called, even when the same input values are provided.

Why is this important? It is important because of how functions may be used within views, user-defined functions, and stored procedures. The restrictions vary across implementations, but these objects sometimes allow only deterministic functions within their defining code. For example, Microsoft SQL Server allows the creation of an index on a column expression--as long as the expression does not contain nondeterministic functions. Rules and restrictions vary between the vendors, so check their documentation when using functions.

Types of Functions

There are several basic types and categories of functions in SQL99 and vendor implementations of SQL. The basic types of functions are:

Aggregate functions
Operate against a collection of values, but return a single, summarizing value.
Scalar functions
Operate against a single value, and return a single value based on the input value. Some scalar functions, CURRENT_TIME for example, do not require any arguments.

Aggregate Functions

Aggregate functions return a single value based upon a set of other values. If used among many other expressions in the item list of a SELECT statement, the SELECT must have a GROUP BY clause. No GROUP BY clause is required if the aggregate function is the only value retrieved by the SELECT statement. The supported aggregate functions and their syntax are listed in Table 4-1.

Table 4-1: SQL99 Aggregate Functions

Function

Usage

AVG(expression)

Computes the average value of a column by the expression

COUNT(expression)

Counts the rows defined by the expression

COUNT(*)

Counts all rows in the specified table or view

MIN(expression)

Finds the minimum value in a column by the expression

MAX(expression)

Finds the maximum value in a column by the expression

SUM(expression)

Computes the sum of column values by the expression

Technically speaking, ANY, EVERY, and SOME are considered aggregate functions. However, they have been discussed as range search criteria since they are most often used that way. Refer to the SELECT . . . WHERE topic in the previous chapter for more information on these functions.

The number of values processed by an aggregate varies depending on the number of rows queried from the table. This behavior makes aggregate functions different from scalar functions, which require a fixed number and fixed type of parameters.

The general syntax of an aggregate function is:


aggregate_function_name ( [ALL | DISTINCT] expression )  

The aggregate function name may be AVG, COUNT, MAX, MIN, or SUM. The ALL clause, which is the default behavior and does not actually need to be specified, evaluates all rows when aggregating the value of the function. The DISTINCT clause uses only distinct values when evaluating the function.

AVG and SUM

The AVG function computes the average of values in a column or an expression. SUM computes the sum. Both functions work with numeric values and ignore NULL values. They also can be used to compute the average or sum of all distinct values of a column or expression.

AVG and SUM are supported by Microsoft SQL Server, MySQL, Oracle, and PostgreSQL.

Example

The following query computes average year-to-date sales for each type of book:


SELECT   type, AVG( ytd_sales ) AS "average_ytd_sales"

FROM     titles 

GROUP BY type;

This query returns the sum of year-to-date sales for each type of book:


SELECT   type, SUM( ytd_sales ) 

FROM     titles 

GROUP BY type;

COUNT

The COUNT function has three variations. COUNT(*) counts all the rows in the target table whether they include nulls or not. COUNT(expression) computes the number of rows with non-NULL values in a specific column or expression. COUNT(DISTINCT expression) computes the number of distinct non-NULL values in a column or expression.

Examples

This query counts all rows in a table:


SELECT COUNT(*) FROM publishers;

The following query finds the number of different countries where publishers are located:


SELECT COUNT(DISTINCT country) "Count of Countries" 

FROM   publishers

MIN and MAX

MIN(expression) and MAX(expression) find the minimum and maximum value (string, datetime, or numeric) in a set of rows. DISTINCT or ALL may be used with these functions, but they do not affect the result.

MIN and MAX are supported by Microsoft SQL Server, MySQL, Oracle, and PostgreSQL.

MySQL also supports the functions LEAST( ) and GREATEST( ), providing the same capabilities.

Examples

The following query finds the best and worst sales for any title on record:


SELECT  'MIN' = MIN(ytd_sales), 'MAX' = MAX(ytd_sales) 

FROM    titles;

Aggregate functions are used often in the HAVING clause of queries with GROUP BY. The following query selects all categories (types) of books that have an average price for all books in the category higher than $15.00:


SELECT  type 'Category', AVG( price ) 'Average Price'

FROM    titles 

GROUP BY type 

HAVING AVG(price) > 15

Scalar Functions

Scalar functions fall into the categories listed in Table 4-2....

Read More Show Less

Table of Contents

1 SQL history and implementations 1
2 Foundational concepts 16
3 SQL statement command reference 57
4 SQL functions 473
5 Database programming 590
A Sybase adaptive server 621
B Shared and platform-specific keywords 635
Read More Show Less

Customer Reviews

Average Rating 4
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Anonymous

    Posted October 28, 2004

    maintaining several SQL implementations?

    [A review of the 2nd edition, 2004.] Perhaps the best virtue of this book is that it spans all the major variants of SQL - db2, Oracle, MySQL, PostgreSQL and Microsoft's SQL Server. The authors are not beholden to any particular vendor. Thus the book describes the common ground. That is, the commands and usage that are most likely to be the same or similar across these implementations. Because a major use of this book might be in migrating. To this end, the more code you can have in this common area, the less painful the migration. Another possible usage is if you are a DBA in charge of running 2 [or more] of these implementations. Perhaps due to some legacy issues, you have to support them. If you cannot merge SQL code into one common version, you can get problems. Being able to use this book to find quickly common commands and options to those commands might greatly help you maximise a common body of code.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted August 20, 2002

    A quick-reference should be quick and reasonably complete.

    Contrary to several reviewers, this book is *not* well-suited to its purpose, especially compared to O'Reilly's usual high standards. You can't find what you need quickly, basic information is often missing, and there are enough glaring typos to make everything in the book suspect. This is particularly true of the book's main claim to fame, the myriad of small differences between database products. Some examples: (1) The book explains that some databases use '!=' instead of the standard SQL not-equal operator, '<>'. Which databases? Do they support both operators, or just '!='? The book doesn't say. (2a) The book doesn't tell you that MySQL doesn't support subqueries in SELECT statements -- even though there's a subsection on 'MySQL Syntax and Variations' for SELECT statements. (2b) The index has no entries for subqueries under any conceivable heading: queries, nested queries, subqueries, or SELECT. So you can spend quite a long time *trying* to find out which databases support subqueries. (Most do.) (3) The table of contents has a glaring typo, that makes you wonder what else got past the proofreaders and fact-checkers. Chapter 3, 'SQL Statements Command Reference' doesn't have sub-headings for individual commands or groups of commands ... except for one: 'DROP Statements', which are supposedly discussed for 70 pages, a third of the book. If O'Reilly was in such a rush to get the book out that they didn't notice this, how can you have confidence in the book's accuracy?

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted July 3, 2002

    Best Buy for a General SQL Title

    If you are someone like me, someone who takes a broad brush approach to developing and thinks that there is an appropriate database vendor or open source solution for every scenario, you will really love having this book on your reference shelf. The cross-platform references are excellent and show every option and attribute in thorough and accurate detail for several major database solutions. On first glance, some may scoff at 'how easy SQL is' until they move to a new database. If you pointed out the cross platform references during their first mockery, they will be apologizing and begging you to borrow it because it has the value of five books in one thin, easy to read an navigate title.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted January 16, 2001

    Well Suited to its Purpose

    SQL in a Nutshell is designed as a cross- platform reference guide for people like me who are not experts and have to move between RDMS implementations (including desktop apps). In fact, SQL in a Nutshell's great virtue is that it finally levels the playing field by putting PostgreSQL and MySQL, the popular open source RDMS, on the same level with MS SQL Server and Oracle, each of which easily has its own market for high-end manuals and guides, while open source apps are freely available online. So, if you need full documentation on your favorite RDMS, go ahead and spend a couple of hundred dollars somewhere else. If you want a handy reference, simple explanations and comparisons, and an easy to read introduction to the four most important RDMSs currently available, pick up SQL in a Nutshell. You won't be disappointed.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)