SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Judith S. Bowman has been a database professional since the early 1980s. She is currently an independent consultant specializing in SQL and relational database issues and is the author of Practical SQL: The Sequel (Addison-Wesley, 2001). Sandra L. Emerson is an independent consultant and former Vice President of Publishing Programs for Sybase. Marcy Darnovsky, teaches at colleges throughout the San Francisco Bay area. She was formerly at Sybase.
0201703092AB04062001
This latest edition of the best-selling implementation guide to the Structured Query Language teaches SQL fundamentals while providing practical solutions for critical business applications. The Practical SQL Handbook, Fourth Edition now includes expanded platform SQL coverage and extensive real-world examples based on feedback from actual SQL users.
The Practical SQL Handbook begins with a step-by-step introduction to SQL basics and examines the issues involved in designing SQL-based database applications. It fully explores SQLs most popular implementations from industry leaders, Oracle, Microsoft, Sybase, and Informix.
Highlights include:
A bonus CD-ROM contains a time-limited, full-feature version of the Sybase® Adaptive Server Anywhere™ software as well as the sample database, scripts, and examples included in the book.
The Practical SQL Handbook is the most complete reference available for day-to-day SQL implementations.
Click below for Source Code related to this title:
creates.zip
inserts.zip
psh4read.txt
views.zip
Comparing Autonumbering Methods in Different Relational Database Management Systems
Practical SQL: Finding and Changing Words ("&" to "and")
Practical SQL: Making the Best Use of Views
Practical SQL: Selecting Data from the Database
Practical SQL: Subqueries in FROM and SELECT Clauses
Practical SQL: Creating and Using Views
Click below for Sample Chapter related to this title:
bowmanch4.pdf
Preface.
Introduction.
1.SQL and Relational Database Management.
2. Designing Datases.
3. Creating and Filling a Database.
4. Selecting Data from the Database.
5. Sorting Data and Other Selection Techniques.
6. Grouping Data and Reporting from it.
7. Joining Tables for Comprehensive Data Analysis.
8. Structuring Queries with Subqueries.
9. Creating and Using Views.
10. Security, Transactions, Performance, and Integrity.
11. Solving Business Problems.
Appendix A: Syntax Summary for the SQL Used in This Book.
Appendix B: Industry SQL Equivalents.
Appendix C: Glossary.
Appendix D: The 'bookbiz' Sample Database.
*, See asterisk
%, See wildcards
_, See wildcards
--, See comment marks
/*, See comment marks
*/, See comment marks
||, See concatenation
+, See concatenation
*=, See outer joins
=*, See outer joins
(+), See outer joins
. . ., See ellipses
A
access
in views, 325
permissions in, 15, 315
strategies in, 5, 387
Adaptive Server Enterprise, 178179
adding
columns, 300301
rows, 8393
aggregate functions, 143, 162172, 192, 387
AVG, 164, 165, 166
COUNT, 164, 165, 166
COUNT (*), 164, 165
datatypes and, 165166
DISTINCT with, 166, 371, 373375
GROUP BY clause, 175192
with, 187188
without, 186187
grouping and, 175
in guaranteeing single value, 267268
MAX, 164, 165, 166
MIN, 164, 165, 166
NULL values and, 170171
scalar, 175176
SUM, 164, 165, 166
syntax of, 164
vector, 175
views and, 308309
WHERE clause and, 169170
aliases, 150, 259, 387
in FROM clause table/view list, 216217
in SELECT clause, 103
ALL, 100, 155162, 253
comparing with IN and ANY, 263
subqueries with, 259266
ALTER COLUMN, 8081
ALTER commands, 79
ALTER SESSION SET EVENTS command,
388
ALTER TABLE command, 8081
ALTER clause in, 80
DELETE (DROP) clause in, 80
joins and, 208
MODIFY clause in, 80, 81
ANALYZE, 334
AND, 121, 221
semantic issues with, 122123
ANSI standard, 16, 3233, 353
on views, 306310
anti-join, 256, 387
ANY, 253, 259266
comparing with IN and ALL, 263
subqueries with, 259266
apostrophes, embedded, 106107
argument, 388
arithmetic operators, 61, 100, 107109, 388
precedence in, 111114
AS, 284285
in CREATE VIEW, 284
in display label, 103104
ASC, 149
association, 36, 388
asterisk (*)
in asking for columns, 6
in comments, 225
with COUNT, 165
indiscriminate use of queries, 215
in outer joins, 226-227
in select_list, 100-101, 253
@ sign, as designated escape character, 138
attributes, 3, 388. See also column(s); fields
diagramming, 3031
AUTOTRACE ON, 337
AVG, 100, 164166
AVG (DISTINCT expression), 164, 166
B
base tables, 10, 388
BEGIN, 328
benchmarking, 330332, 388
BETWEEN, 127
to specify inclusive range, 128
binary datatypes, 63, 388
bit datatypes, 63, 388
bookbiz database, 2728, 4649, 287
CREATE statements, 414427
CREATE VIEW statements, 446449
database details, 379
data entities, 2933
defining tables in, 6668
INSERT statements, 427446
installing, 5152
sample, 379449
table charts, 379414
Boolean operators, 120, 388
AND, 121
NOT, 124
OR, 121122
braces ( { } ), 53, 54
brackets ( [ ] ), 53, 60, 61
business problems, 345392
avoiding mistakes, 370378
conditional thinking, 346352
formatting and displaying data, 353361
on the job uses of SQL, 345346
playing with patterns, 361370
C
Cartesian product, 230232, 388
constraining, 233
using, 232233
cascade, 342, 388
CASE function, 346350, 391
CAST function, 358360, 361, 368
changing
data, 8393
databases, 79
table definitions, 7981
CHARACTER (CHAR), 62, 63, 206, 388
character datatypes, 61, 62, 389
character functions, 384
character sets, 146, 389
character strings
matching, 134139
in query results, 106107
character values, comparing, 119
CHECK constraints, 73, 74, 78
compared to CREATE RULE command, 340
in CREATE TABLE command, 340
clustered index, 69, 71, 389
COALESCE, 201, 351352
Codd, E. F., xxvii, 2, 14, 15, 16
twelve-rule test for relational systems, 2
COLLATE, 146
collating sequence. See sort order
collation, 146. See also sort order
COLLATION FROM, 146
column(s), 3, 389
adding, 300301
assigning NOT NULL to, 6465
assigning NULL to, 6465
asterisk (*) in asking for, 6
choosing, 100101
all, 101102
specific, 102
choosing datatypes for, 6165
combining, with display headings and text in SELECT list, 107
computed, 307308
connecting, 205
display headings for, 109110
displaying one as two, 353356
displaying two as one, 356358
DISTINCT with, 371, 372373
implementing constraints
on individual, 7577
on multiple, 7779
indexes for, 6972
inserting data into all
with SELECT, 8687
with VALUES, 8485
inserting data into some
with SELECT, 8889
with VALUES, 8586
join, 205
join-compatible, 206
limiting the width of the display, 214216
rearranging result, 102103
specifying, 89
column aliases, 103
column headings, 103. See also display labels
column names, 296298
computations with, 110111
duplicate, 297298
qualifying, 246247, 248249
command, 5
commas (,), 5354, 61
comment marks, 211, 225
COMMIT, 328, 330
comparison operators, 116120, 389
correlated subqueries with, 259266,
269270
IS NULL and other, 134
unmodified, 266
comparisons, 381
character values, 119
datatypes, 382383
functions, 384386
imaginary values, 119120
involving NULLs, 198199
naming convention, 381382
numbers, 118119
complex expression, sorting by, 153
composite indexes, 6970, 389
comprehensive data sublanguages, 5, 389
computations
with column names, 110111
NULLs and, 199201
computed columns, 307308
display headings for, 109110
concatenation, 356358
concurrency and transactions, 326327
concurrency control, 316, 390
conditional functions, 346352, 385
conditions, connecting with logical operato