0% found this document useful (0 votes)
7 views57 pages

SQL A Beginner S Guide 3rd Edition Andy Oppel Download PDF

SQL A Beginner's Guide, 3rd Edition by Andy Oppel and Robert Sheldon is a comprehensive resource for learning SQL and relational databases. The document includes links to download the book and other related beginner guides, as well as information about the authors' backgrounds and expertise. It covers various topics such as SQL statements, execution types, and working with the SQL environment.

Uploaded by

yyqzwocsua249
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views57 pages

SQL A Beginner S Guide 3rd Edition Andy Oppel Download PDF

SQL A Beginner's Guide, 3rd Edition by Andy Oppel and Robert Sheldon is a comprehensive resource for learning SQL and relational databases. The document includes links to download the book and other related beginner guides, as well as information about the authors' backgrounds and expertise. It covers various topics such as SQL statements, execution types, and working with the SQL environment.

Uploaded by

yyqzwocsua249
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

SQL A Beginner s Guide 3rd Edition Andy Oppel

download pdf

https://ebookfinal.com/download/sql-a-beginner-s-guide-3rd-edition-andy-
oppel/

Visit ebookfinal.com today to download the complete set of


ebook or textbook!
Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Databases A Beginner s Guide 1st Edition Andy Oppel

https://ebookfinal.com/download/databases-a-beginner-s-guide-1st-
edition-andy-oppel/

SQL A Beginner s Guide 2nd Edition Robert Sheldon

https://ebookfinal.com/download/sql-a-beginner-s-guide-2nd-edition-
robert-sheldon/

SQL QuickStart Guide The Simplified Beginner s Guide to


SQL Clydebank Technology

https://ebookfinal.com/download/sql-quickstart-guide-the-simplified-
beginner-s-guide-to-sql-clydebank-technology/

Network Security A Beginner s Guide Second Edition


Beginner s Guide Eric Maiwald

https://ebookfinal.com/download/network-security-a-beginner-s-guide-
second-edition-beginner-s-guide-eric-maiwald/
Wordpress Theme Development Beginner s Guide 3rd Edition
Rachel Mccollin

https://ebookfinal.com/download/wordpress-theme-development-beginner-
s-guide-3rd-edition-rachel-mccollin/

Beginner s Guide to Adobe Photoshop 3rd Edition Michelle


Perkins

https://ebookfinal.com/download/beginner-s-guide-to-adobe-
photoshop-3rd-edition-michelle-perkins/

Blender Game Engine Beginner s Guide Beginner s Guide 1st


ed Edition Bacone

https://ebookfinal.com/download/blender-game-engine-beginner-s-guide-
beginner-s-guide-1st-ed-edition-bacone/

The Brain A Beginner s Guide Oneworld Beginner s Guides


1st Edition Ammar Al-Chalabi

https://ebookfinal.com/download/the-brain-a-beginner-s-guide-oneworld-
beginner-s-guides-1st-edition-ammar-al-chalabi/

Networking A Beginner s Guide Fifth Edition Bruce Hallberg

https://ebookfinal.com/download/networking-a-beginner-s-guide-fifth-
edition-bruce-hallberg/
SQL A Beginner s Guide 3rd Edition Andy Oppel Digital
Instant Download
Author(s): Andy Oppel, Robert Sheldon
ISBN(s): 9780071548649, 0071548645
File Details: PDF, 4.34 MB
Year: 2008
Language: english
www.it-ebooks.info
SQL
A Beginner’s Guide
Third Edition

Andy Oppel
Robert Sheldon

New York Chicago San Francisco


Lisbon London Madrid Mexico City
Milan New Delhi San Juan
Seoul Singapore Sydney Toronto

www.it-ebooks.info
Copyright © 2009 by The McGraw-Hill Companies. All rights reserved. Manufactured in the United States of America. Except as
permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by
any means, or stored in a database or retrieval system, without the prior written permission of the publisher.

0-07-154865-3

The material in this eBook also appears in the print version of this title: 0-07-154864-5.

All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked
name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the
trademark. Where such designations appear in this book, they have been printed with initial caps.

McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training
programs. For more information, please contact George Hoare, Special Sales, at george_hoare@mcgraw-hill.com or (212) 904-4069.

TERMS OF USE

This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the work.
Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy
of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit,
distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use the work
for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be
terminated if you fail to comply with these terms.

THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO
THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUD-
ING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND
EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WAR-
RANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or
guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free.
Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the
work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the
work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential
or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such
damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or
otherwise.

DOI: 10.1036/0071548645

www.it-ebooks.info
About the Authors
Andrew (Andy) J. Oppel is a proud graduate of the Boys’ Latin School of Maryland and of
Transylvania University (Lexington, Kentucky) where he earned a BA in computer science
in 1974. Since then he has been continuously employed in a wide variety of information
technology positions, including programmer, programmer/analyst, systems architect, project
manager, senior database administrator, database group manager, consultant, database designer,
data modeler, and data architect. In addition, he has been a part-time instructor with the
University of California (Berkeley) Extension for over 20 years, and received the Honored
Instructor Award for the year 2000. His teaching work included developing three courses for
UC Extension, “Concepts of Database Management Systems,” “Introduction to Relational
Database Management Systems,” and “Data Modeling and Database Design.” He also earned
his Oracle 9i Database Associate certification in 2003. He is currently employed as a senior data
modeler for Blue Shield of California. Aside from computer systems, Andy enjoys music (guitar
and vocals), amateur radio (Pacific Division vice director, American Radio Relay League) and
soccer (referee instructor, U.S. Soccer).
Andy has designed and implemented hundreds of databases for a wide range of applications,
including medical research, banking, insurance, apparel manufacturing, telecommunications,
wireless communications, and human resources. He is the author of Databases Demystified
(McGraw-Hill/Osborne, 2004) and SQL Demystified (McGraw-Hill/Osborne, 2005). His database
product experience includes IMS, DB2, Sybase, Microsoft SQL Server, Microsoft Access,
MySQL, and Oracle (versions 7, 8, 8i, 9i, and 10g).
Robert Sheldon has worked as a consultant and technical writer for a number of years.
As a consultant, he has managed the development and maintenance of web-based and client-
server applications and the databases that supported those applications. He has designed and
implemented various Access and SQL Server databases and has used SQL to build databases,
create and modify database objects, query and modify data, and troubleshoot system- and
data-related problems. Robert has also written or cowritten eight books on various network
and server technologies, one of which received a Certificate of Merit from the Puget Sound
Chapter of the Society for Technical Communication. In addition, two of the books that
Robert has written focus exclusively on SQL Server design and implementation. Robert
has also written and edited a variety of other documentation related to SQL databases and
other computer technologies. His writing includes material outside the computer industry—
everything from news articles to ad copy to legal documentation—and he has received two
awards from the Colorado Press Association.

About the Technical Editor


James Seymour is a graduate of the University of North Carolina at Chapel Hill with a BA in
history and political science and the University of Kentucky with a MA in history. He became
first involved with computer technology in 1965 with the mainframe environment at North
Carolina. While in the United States Army during the Vietnam War, he was on the small team
that worked with the mainframe setup at the Pentagon for various military strategic scenarios.
Since 1972, he has been involved in varied computer environments with the second point-of-sale

Copyright © 2009 by The McGraw-Hill Companies. Click here for terms of use.
www.it-ebooks.info
and inventory control project in the retail industry, analytical programs and database initiatives in
the insurance and benefits industries, loss control startups, and other inventory control and sales
tracking projects throughout many different industries.
From 1987 through 1995, James was an instructor of database management in the community
college system of the state of Kentucky. In this capacity, he created the first database management
and C programming courses in the state of Kentucky and helped both public and private entities
with urgent training needs, including the programming of guidance systems on cruise missiles for
Desert Storm.
Before 1985, he was a system administrator, network administrator, programmer, and
database administrator. Since 1985, James has been a senior database administrator working
primarily with DB2 and Oracle DBMSs on multiple platforms including SQL Server
beginning with version 7.0. He is currently the senior database administrator and data
architect for a Fortune 100 company overseeing major projects in the United States, Canada,
and the United Kingdom.

www.it-ebooks.info
For more information about this title, click here

Contents
ACKNOWLEDGMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

PART I Relational Databases and SQL

1 Introduction to Relational Databases and SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . 3


Understand Relational Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
The Relational Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Learn About SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
The SQL Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Types of SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Types of Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
SQL Standard versus Product Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2 Working with the SQL Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Understand the SQL Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Understand SQL Catalogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Schema Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Then What Is a Database? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Name Objects in an SQL Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Qualified Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

www.it-ebooks.info
vi SQL: A Beginner’s Guide

Create a Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Create a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3 Creating and Altering Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Create SQL Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Specify Column Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
String Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Numeric Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Datetime Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Interval Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Boolean Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Using SQL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Create User-Defined Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Specify Column Default Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Delete SQL Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4 Enforcing Data Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Understand Integrity Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Use NOT NULL Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Add UNIQUE Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Add PRIMARY KEY Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Add FOREIGN KEY Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
The MATCH Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
The <referential triggered action> Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Define CHECK Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Defining Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Creating Domains and Domain Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5 Creating SQL Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Add Views to the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Defining SQL Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Create Updateable Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Using the WITH CHECK OPTION Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Drop Views from the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
6 Managing Database Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Understand the SQL Security Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
SQL Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Accessing Database Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Create and Delete Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Grant and Revoke Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Revoking Privileges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Grant and Revoke Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Revoking Roles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

www.it-ebooks.info
Contents vii

PART II Data Access and Modification

7 Querying SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145


Use a SELECT Statement to Retrieve Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
The SELECT Clause and FROM Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Use the WHERE Clause to Define Search Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Defining the WHERE Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Use the GROUP BY Clause to Group Query Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Use the HAVING Clause to Specify Group Search Conditions . . . . . . . . . . . . . . . . . . . . . . . 164
Use the ORDER BY Clause to Sort Query Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
8 Modifying SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Insert SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Inserting Values from a SELECT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Update SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Updating Values from a SELECT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Delete SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
9 Using Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Compare SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Using the BETWEEN Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Return Null Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Return Similar Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Reference Additional Sources of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Using the IN Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Using the EXISTS Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Quantify Comparison Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Using the SOME and ANY Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Using the ALL Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
10 Working with Functions and Value Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Use Set Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Using the COUNT Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Using the MAX and MIN Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Using the SUM Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Using the AVG Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Use Value Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Working with String Value Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Working with Datetime Value Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Use Value Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Working with Numeric Value Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Using the CASE Value Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Using the CAST Value Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Use Special Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

www.it-ebooks.info
viii SQL: A Beginner’s Guide

11 Accessing Multiple Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253


Perform Basic Join Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Using Correlation Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Creating Joins with More than Two Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Creating the Cross Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Creating the Self-Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Join Tables with Shared Column Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Creating the Natural Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Creating the Named Column Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Use the Condition Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Creating the Inner Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Creating the Outer Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Perform Union Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
12 Using Subqueries to Access and Modify Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Create Subqueries That Return Multiple Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Using the IN Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Using the EXISTS Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Using Quantified Comparison Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Create Subqueries That Return One Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Work with Correlated Subqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Use Nested Subqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Use Subqueries to Modify Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Using Subqueries to Insert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Using Subqueries to Update Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Using Subqueries to Delete Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

PART III Advanced Data Access

13 Creating SQL-Invoked Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299


Understand SQL-Invoked Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
SQL-Invoked Procedures and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Working with the Basic Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Create SQL-Invoked Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Invoking SQL-Invoked Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Add Input Parameters to Your Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Using Procedures to Modify Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Add Local Variables to Your Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Work with Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Create Compound Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
Create Conditional Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Create Looping Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Add Output Parameters to Your Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
Create SQL-Invoked Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

www.it-ebooks.info
Contents ix

14 Creating SQL Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329


Understand SQL Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Trigger Execution Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Create SQL Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Referencing Old and New Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Dropping SQL Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Create Insert Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Create Update Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
Create Delete Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
15 Using SQL Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Understand SQL Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Declaring and Opening SQL Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Declare a Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Working with Optional Syntax Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Creating a Cursor Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Open and Close a Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Retrieve Data from a Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
Use Positioned UPDATE and DELETE Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Using the Positioned UPDATE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Using the Positioned DELETE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
16 Managing SQL Transactions .............................................. 377
Understand SQL Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Set Transaction Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Specifying an Isolation Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Specifying a Diagnostics Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Creating a SET TRANSACTION Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Start a Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Set Constraint Deferability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
Create Savepoints in a Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Releasing a Savepoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Terminate a Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Committing a Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Rolling Back a Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
17 Accessing SQL Data from Your Host Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Invoke SQL Directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Embed SQL Statements in Your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Creating an Embedded SQL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Using Host Variables in Your SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Retrieving SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

www.it-ebooks.info
x SQL: A Beginner’s Guide

Create SQL Client Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417


Defining SQL Client Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
Use an SQL Call-Level Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Allocating Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Executing SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Working with Host Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Retrieving SQL Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
18 Working with XML Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Learn the Basics of XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Learn About SQL/XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
The XML Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
SQL/XML Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
SQL/XML Mapping Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441

PART IV Appendices

A Answers to Self Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449


B SQL:2006 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
SQL Reserved Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
SQL Nonreserved Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
C SQL Code Used in Try This Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
SQL Code by Try This Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498
The INVENTORY Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519

www.it-ebooks.info
Acknowledgments
T here were many people involved in the development of SQL: A Beginner’s Guide,
Third Edition, many of whom I do not know by name. First, the editors and staff at
McGraw-Hill Professional provided countless hours of support for this project. I wish to
especially thank executive editor Jane K. Brownlow, acquisitions coordinator Jennifer Housh,
and Wilson Drozdowski who briefly filled in for Jennifer, as the individuals with whom I had
direct contact throughout the writing and editing process. Your comments and suggestions,
as well as quick and accurate answers to my many questions, made the writing tasks flow
without a hitch; your work behind the scenes kept the entire project moving smoothly. I also
wish to thank the copy editor and all the other editors, proofreaders, indexers, designers,
illustrators, and other participants whose names I do not know. My special thanks go to my
friend and former colleague Jim Seymour, the technical editor, for his attention to detail and
his helpful input throughout the editing process. And I wish to acknowledge the work of
Robert Sheldon, author of the first two editions, whose excellent writing made the revisions
required for this edition so much easier to accomplish. Finally, my thanks to my family for
their support and understanding as I fit the writing schedule into an already overly busy life.

—Andy Oppel

Introduction
R elational databases have become the most common data storage mechanism for modern
computer applications. Programming languages such as Java, C, and COBOL, and
scripting languages such as Perl, VBScript, and JavaScript must often access a data source
in order to retrieve or modify data. Many of these data sources are managed by a relational
database management system (RDBMS), such as Oracle, Microsoft SQL Server, MySQL, and
DB2, that relies on the Structured Query Language (SQL) to create and alter database objects,
add data to and delete data from the database, modify data that has been added to that database,
and of course, retrieve data stored in the database for display and processing.
SQL is the most widely implemented language for relational databases. Much as
mathematics is the language of science, SQL is the language of relational databases. SQL not
only allows you to manage the data within the database, but also manage the database itself.

xi
Copyright © 2009 by The McGraw-Hill Companies. Click here for terms of use.
www.it-ebooks.info
xii SQL: A Beginner’s Guide

By using SQL statements, you can access an SQL database directly by using an interactive
client application or through an application programming language or scripting language.
Regardless of which method you use to access a data source, a foundation in how to write
SQL statements is required in order to access relational data. SQL: A Beginner’s Guide,
Third Edition provides you with such a foundation. It describes the types of statements that
SQL supports and explains how they’re used to manage databases and their data. By working
through this book, you’ll build a strong foundation in basic SQL and gain a comprehensive
understanding of how to use SQL to access data in your relational database.
This third edition has been updated to include the provisions of the ISO SQL:2006
standard, along with technical corrigenda published in 2007. Chapter 18 has been added
to cover SQL/XML, which was added to the SQL standard in 2006. In addition, the SQL
statements have been reformatted and all database object names folded to uppercase to
improve readability and transportability across the wide variety of commercially available
RDBMS products.

Who Should Read This Book


SQL: A Beginner’s Guide is recommended for anyone trying to build a foundation in SQL
programming based on the ISO SQL:2006 standard. The book is designed specifically for
those who are new or relatively new to SQL; however, those of you who need a refresher in
SQL will also find this book beneficial. Whether you’re an experienced programmer, have had
some web development experience, are a database administrator, or are new to programming
and databases, SQL: A Beginner’s Guide provides a strong foundation that will be useful to
anyone wishing to learn more about SQL. In fact, any of the following individuals will find
this book helpful when trying to understand and use SQL:

● The novice new to database design and SQL programming


● The analyst or manager who wants to better understand how to implement and access SQL
databases
● The database administrator who wants to learn more about programming
● The technical support professional or testing/QA engineer who must perform ad hoc
queries against an SQL data source
● The web developer writing applications that must access SQL databases
● The third-generation language (3GL) programmer embedding SQL within an application’s
source code
● Any other individual who wants to learn how to write SQL code that can be used to create
and access databases within an RDBMS

Whichever category you might fit into, an important point to remember is that the book
is geared toward anyone wanting to learn standard SQL, not a product-specific version of
the language. The advantage of this is that you can take the skills learned in this book and

www.it-ebooks.info
Introduction xiii

apply them to real-world situations, without being limited to product standards. You will, of
course, still need to be aware of how the product you work in implements SQL, but with the
foundation provided by this book, you’ll be able to move from one RDBMS to the next and
still have a basic understanding of how SQL is used. As a result, this book is a useful tool to
anyone new to SQL-based databases, regardless of the product used. SQL programmers need
only adapt their knowledge to the specific RDBMS.

What Content the Book Covers


SQL: A Beginner’s Guide is divided into three parts. Part I introduces you to the basic concepts
of SQL and explains how to create objects within your database. Part II provides you with
a foundation in how to retrieve data from a database and modify (add, change, and delete)
the data that’s stored in the database. Part III provides you with information about advanced
data access techniques that allow you to expand on what you learned in Part I and Part II.
In addition to the three parts, SQL: A Beginner’s Guide contains appendixes that include
reference material for the information presented in the three parts.

Description of the Book’s Content


The following outline describes the contents of the book and shows how the book is broken
down into task-focused chapters.

Part I: Relational Databases and SQL


Chapter 1: Introduction to Relational Databases and SQL
This chapter introduces you to relational databases and the relational model, which forms the
basis for SQL. You’ll also be provided with a general overview of SQL and how it relates to
RDBMSs.
Chapter 2: Working with the SQL Environment
This chapter describes the components that make up the SQL environment. You’ll also be
introduced to the objects that make up a schema, and you’ll learn how to create a schema
within your SQL environment. You’ll also be introduced to the concept of creating a database
object in an SQL implementation that supports the creation of database objects.
Chapter 3: Creating and Altering Tables
In this chapter, you’ll learn how to create SQL tables, specify column data types, create
user-defined types, and specify column default values. You’ll also learn how to alter a table
definition and delete that definition from your database.
Chapter 4: Enforcing Data Integrity
This chapter explains how integrity constraints are used to enforce data integrity in your
SQL tables. The chapter includes information on table-related constraints, assertions, and
domain constraints. You will learn how to create NOT NULL, UNIQUE, PRIMARY KEY,
FOREIGN KEY, and CHECK constraints.

www.it-ebooks.info
xiv SQL: A Beginner’s Guide

Chapter 5: Creating SQL Views


In this chapter, you’ll learn how to add views to your SQL database. You’ll also learn how to
create updateable views and how to drop views from the database.
Chapter 6: Managing Database Security
In this chapter, you’ll be introduced to the SQL security model and learn how authorization
identifiers are defined within the context of a session. You’ll then learn how to create and
delete roles, grant and revoke privileges, and grant and revoke roles.

Part II: Data Access and Modification


Part II explains how to access and modify data in an SQL database. You’ll also learn how
to use predicates, functions, and value expressions to manage that data. In addition, Part II
describes how to join tables and use subqueries to access data in multiple tables.
Chapter 7: Querying SQL Data
This chapter describes the basic components of the SELECT statement and how the statement
is used to retrieve data from an SQL database. You’ll learn how to define each clause that can
be included in the SELECT statement and how those clauses are processed when querying a
database.
Chapter 8: Modifying SQL Data
In this chapter, you’ll learn how to modify data in an SQL database. Specifically, you’ll learn
how to insert data, update data, and delete data. The chapter reviews each component of the
SQL statements that allow you to perform these data modifications.
Chapter 9: Using Predicates
In this chapter, you’ll learn how to use predicates to compare SQL data, return null values,
return similar values, reference additional sources of data, and quantify comparison predicates.
The chapter describes the various types of predicates and shows you how they’re used to
retrieve specific data from an SQL database.
Chapter 10: Working with Functions and Value Expressions
This chapter explains how to use various types of functions and value expressions in your
SQL statements. You’ll learn how to use set functions, value functions, value expressions, and
special values in various clauses within an SQL statement.
Chapter 11: Accessing Multiple Tables
This chapter describes how to join tables in order to retrieve data from those tables. You will
learn how to perform basic join operations, join tables with shared column names, use the
condition join, and perform union operations.
Chapter 12: Using Subqueries to Access and Modify Data
In this chapter, you’ll learn how to create subqueries that return multiple rows and others
that return only one value. You’ll also learn how to use correlated subqueries and nested
subqueries. In addition, you’ll learn how to use subqueries to modify data.

www.it-ebooks.info
Introduction xv

Part III: Advanced Data Access


Part III introduces you to advanced data-access techniques such as SQL-invoked routines,
triggers, and cursors. You’ll also learn how to manage transactions, how to access SQL data
from your host program, and how to incorporate XML data into your database.
Chapter 13: Creating SQL-Invoked Routines
This chapter describes SQL-invoked procedures and functions and how you can create them
in your SQL database. You’ll learn how to define input parameters, add local variables to your
routine, work with control statements, and use output parameters.
Chapter 14: Creating SQL Triggers
This chapter introduces you to SQL triggers and explains how to create insert, update, and
delete triggers in your SQL database. You’ll learn how triggers are automatically invoked and
what types of actions they can take.
Chapter 15: Using SQL Cursors
In this chapter, you’ll learn how SQL cursors are used to retrieve one row of data at a time
from a result set. The chapter explains how to declare a cursor, open and close a cursor, and
retrieve data from a cursor. You’ll also learn how to use positioned UPDATE and DELETE
statements after you fetch a row through a cursor.
Chapter 16: Managing SQL Transactions
In this chapter, you’ll learn how transactions are used to ensure the integrity of your SQL
data. The chapter describes how to set transaction properties, start a transaction, set constraint
deferability, create savepoints in a transaction, and terminate a transaction.
Chapter 17: Accessing SQL Data from Your Host Program
This chapter describes the four methods supported by the SQL standard for accessing an SQL
database. You’ll learn how to invoke SQL directly from a client application, embed SQL
statements in a program, create SQL client modules, and use an SQL call-level interface to
access data.
Chapter 18: Working with XML Data
This chapter describes how XML data can be incorporated into an SQL database. You’ll learn
the basics of XML, how to use the XML data type to store XML in table column values, how
to write SQL/XML functions that can be used to return data from the database formatted as
XML, and the SQL/XML mapping rules that describe how SQL values are translated to XML
values and vice versa.

Part IV: Appendices


The appendices include reference material for the information presented in the first three parts.
Appendix A: Answers to Self Test
This appendix provides the answers to the Self Test questions listed at the end of each chapter.
Appendix B: SQL: 2006 Keywords
This appendix lists the reserved and nonreserved keywords as they are used in SQL statements
as defined in the SQL:2006 standard.

www.it-ebooks.info
xvi SQL: A Beginner’s Guide

Appendix C: SQL Code Used in Try This Exercises


This appendix lists all the SQL code used in the book’s Try This exercises, consolidated into one
place for easy reference. This code may also be downloaded from http://www.mhprofessional.com.

Chapter Content
As you can see in the outline, SQL: A Beginner’s Guide is organized into chapters. Each
chapter focuses on a set of related tasks. The chapter contains the background information
you need to understand the various concepts related to those tasks, explains how to create
the necessary SQL statements to perform the tasks, and provides examples of how those
statements are created. In addition, each chapter contains additional elements to help you
better understand the information covered in that chapter:

● Ask the Expert Each chapter contains one or two Ask the Expert sections that provide
information on questions that might arise regarding the information presented in the chapter.
● Self Test Each chapter ends with a Self Test, which is a set of questions that tests you
on the information and skills you learned in that chapter. The answers to the Self Test are
given in Appendix A.

SQL Syntax
The syntax of an SQL statement refers to the structure and rules used for that statement, as
outlined in SQL:2006. Most chapters will include the syntax for one or more statements so that
you have an understanding of the basic elements contained in those statements. For example,
the following syntax represents the information you need when you define a CREATE TABLE
statement:
<table definition> ::=
CREATE [ { GLOBAL | LOCAL } TEMPORARY ] TABLE <table name>
( <table element> [ { , <table element> } . . . ] )
[ ON COMMIT { PRESERVE | DELETE } ROWS ]

NOTE
Do not be concerned about the meaning of the SQL code at this time. This example is
meant only to show you how SQL statements are represented in this book.

As you can see, a statement’s syntax can contain many elements. Notice that most of
the words used within the statement are shown in uppercase. The uppercase words are SQL
keywords that are used to formulate the SQL statement. (For a complete list of SQL:2006
keywords, see Appendix B.) Although SQL does not require that keywords be written in
uppercase, I use that convention in this book so that you can easily identify the keywords
within a statement. In addition to the keywords, the syntax for an SQL statement includes a
number of other elements that help define how a particular statement should be created:

● Square brackets The square brackets indicate that the syntax enclosed in those brackets is
optional. For example, the ON COMMIT clause in the CREATE TABLE statement is optional.

www.it-ebooks.info
Introduction xvii

● Angle brackets The angle brackets enclose information that represents a placeholder.
When a statement is actually created, the placeholder is replaced by the appropriate SQL
elements or identifiers. For example, you should replace the <table name> placeholder
with a name for the table when you define a CREATE TABLE statement.
● Curly brackets The curly brackets are used to group elements together. The brackets tell
you that you should first decide how to handle the contents within the brackets and then
determine how they fit into the statement. For example, the PRESERVE | DELETE set of
keywords is enclosed by curly brackets. You must first choose PRESERVE or DELETE
and then deal with the entire line of code. As a result, your clause can read ON COMMIT
PRESERVE ROWS, or it can read ON COMMIT DELETE ROWS.
● Vertical bars The vertical bar can be read as “or,” which means that you should use
either the PRESERVE option or the DELETE option.
● Three periods The three periods indicate that you can repeat the clause as often as
necessary. For example, you can include as many table elements (represented by <table
element>) as necessary.
● Colons/equals sign The ::= symbol (two consecutive colons plus an equals sign)
indicates that the placeholder to the left of the symbol is defined by the syntax following
the symbol. In the syntax example, the <table definition> placeholder equals the syntax
that makes up a CREATE TABLE statement.

By referring to the syntax, you should be able to construct an SQL statement that creates
database objects or modifies SQL data as necessary. However, in order to better demonstrate
how the syntax is applied, each chapter also contains examples of actual SQL statements.

Examples of SQL Statements


Each chapter provides examples of how SQL statements are implemented when accessing an
SQL database. For example, you might see an SQL statement similar to the following:
CREATE TABLE ARTISTS

( ARTIST_ID INT,

ARTIST_NAME VARCHAR(60),

ARTIST_DOB DATE,

POSTER_IN_STOCK BOOLEAN );

Notice that the statement is written in special type to show that it is SQL code. Also notice that
keywords and object names are all uppercase. (You don’t need to be concerned about any other
details at this point.)
The examples used in the book are pure SQL, meaning they’re based on the SQL:2006
standard. You’ll find, however, that in some cases your SQL implementation does not support
an SQL statement in exactly the same way as it is defined in the standard. For this reason,

www.it-ebooks.info
xviii SQL: A Beginner’s Guide

you might also need to refer to the documentation for a particular product to be sure that your
SQL statement conforms to that product’s implementation of SQL. Sometimes it might be
only a slight variation, but there might be times when the product statement is substantially
different from the standard SQL statement.
The examples in each chapter are based on a database related to an inventory of compact
discs. However, the examples are not necessarily consistent in terms of the names used for
database objects and how those objects are defined. For example, two different chapters might
contain examples that reference a table named CD_INVENTORY. However, you cannot
assume that the tables used in the different examples are made up of the same columns or
contain the same content. Because each example focuses on a unique aspect of SQL, the tables
used in examples are defined in a way specific to the needs of that example, as you’ll see as
you get into the chapters. This is not the case for Try This exercises, which use a consistent
database structure throughout the book.

Try This Exercises


Each chapter contains one or two Try This exercises that allow you to apply the information
that you learned in the chapter. Each exercise is broken down into steps that walk you through
the process of completing a particular task. Many of the projects include related files that you
can download from our web site at http://www.osborne.com. The files usually include the
SQL statements used within the Try This exercise. In addition, a consolidation of the SQL
statements is included in Appendix C.
The Try This exercises are based on the INVENTORY database. You’ll create the
database, create the tables and other objects in the database, add data to those tables, and then
manipulate that data. Because the projects build on one another, it is best that you complete
them in the order that they’re presented in the book. This is especially true for the chapters
in Part I, in which you create the database objects, and Chapter 7, in which you insert data
into the tables. However, if you do plan to skip around, you can refer to Appendix C, which
provides all the code necessary to create the database objects and populate the tables with data.
To complete most of the Try This exercises in this book, you’ll need to have access to an
RDBMS that allows you to enter and execute SQL statements interactively. If you’re accessing
an RDBMS over a network, check with the database administrator to make sure that you’re
logging in with the credentials necessary to create a database and schema. You might need
special permissions to create these objects. Also verify whether there are any parameters
you should include when creating the database (for example, log file size), restrictions on
the names you can use, or restrictions of any other kind. Be sure to check the product’s
documentation before working with any database product.

www.it-ebooks.info
Part I
Relational Databases
and SQL

Copyright © 2009 by The McGraw-Hill Companies. Click here for terms of use.
www.it-ebooks.info
Random documents with unrelated
content Scribd suggests to you:
“I shan’t die? Very good, I shan’t die, then. We’ll see who dies first.
Work! Suppose I can’t work? My God! I can’t do the same thing long
at a time! It kills me. If you have been able to, and are able to,
thank God for it, but don’t sit in judgment on others, for it isn’t a
virtue. God gives strength to one, and not to another. But that is the
way you are made, Thomas. You are self-righteous. Oh, wait, that is
not what I am going to say, nor what I accuse you of. I don’t know
where to begin, and however much I can say is only a millionth part
of the feeling I have in my heart against you. You have made a
position for yourself in life; and there you stand, and push
everything away which might possibly disturb your equilibrium for a
moment—for your equilibrium is the most precious thing in the world
to you. But it isn’t the most precious thing in life, Thomas—no,
before God, it is not. You are an egotist, that is what you are. I am
still fond of you, even when you are angry, and tread on me, and
thunder me down. But when you get silent: when somebody says
something and you are suddenly dumb, and withdraw yourself, quite
elegant and remote, and repulse people like a wall and leave the
other fellow to his shame, without any chance of justifying himself—!
Yes, you are without pity, without love, without humility.—Oh,” he
cried, and stretched both arms in front of him, palms outward, as
though pushing everything away from him, “Oh, how sick I am of all
this tact and propriety, this poise and refinement—sick to death of
it!”
The outburst was so genuine, so heart-felt, it sounded so full of
loathing and satiety, that it was actually crushing. Thomas shrank a
little and looked down in front of him, weary and without a word.
At last he said, and his voice had a ring of feeling, “I have become
what I am because I did not want to become what you are. If I have
inwardly shrunk from you, it has been because I needed to guard
myself—your being, and your existence, are a danger to me—that is
the truth.”
There was another pause, and then he went on, in a crisper tone:
“Well, we have wandered far away from the subject. You have read
me a lecture on my character—a somewhat muddled lecture, with a
grain of truth in it. But we are not talking about me, but about you.
You are thinking of marrying; and I should like to convince you that
it is impossible for you to carry out your plan. In the first place, the
interest I shall be able to pay you on your capital will not be a very
encouraging sum—”
“Aline has put some away.”
The Senator swallowed, and controlled himself. “You mean you
would mingle your mother’s inheritance with the—savings of this
lady?”
“Yes. I want a home, and somebody who will be sympathetic when I
am ill. And we suit each other very well. We are both rather
damaged goods, so to speak—”
“And you intend, further, to adopt the existing children and legitimize
them?”
“Yes.”
“So that after your death your inheritance would pass to them?” As
the Senator said this, Frau Permaneder laid her hand on his arm and
murmured adjuringly, “Thomas! Mother is lying in the next room!”
“Yes,” answered Christian. “That would be the way it would be.”
“Well, you shan’t do it, then,” shouted the Senator, and sprang up.
Christian got behind his chair, which he clutched with one hand. His
chin went down on his breast; he looked apprehensive as well as
angry.
“You shan’t do it,” repeated Thomas, almost senseless with anger;
pale, trembling, jerking convulsively. “As long as I am alive it won’t
happen. I swear it—so take care! There’s enough money gone
already, what with bad luck and foolishness and rascality, without
your throwing a quarter of Mother’s inheritance into this creature’s
lap—and her bastards’—and that after another quarter has been
snapped up by Tiburtius! You’ve brought enough disgrace on the
family already, without bringing us home a courtesan for a sister-in-
law, and giving our name to her children. I forbid it, do you hear? I
forbid it!” he shouted, in a voice that made the room ring, and Frau
Permaneder squeeze herself weeping into the corner of the sofa.
“And I advise you not to attempt to defy me! Up to now I have only
despised you and ignored you: but if you try any tricks, if you bring
the worse to the worst, we’ll see who will come out ahead! You can
look out for yourself! I shan’t have any mercy! I’ll have you declared
incompetent, I’ll get you shut up, I’ll ruin you—I’ll ruin you, you
understand?”
“And I tell you—” Thus it all began over again, and went on and on:
a battle of words, destructive, futile, lamentable, without any
purpose other than to insult, to wound, to cut one another to the
quick. Christian came back to his brother’s character and cited
examples of Thomas’s egotism—painful anecdotes out of the distant
past, which he, Christian, had never forgotten, but carried about
with him to feed his bitterness. And the Senator retorted with scorn,
and with threats which he regretted a moment later. Gerda leaned
her head on her hand and watched them, with an expression in her
eyes impossible to read. Frau Permaneder repeated over and over
again, in her despair: “And Mother lying there in the next room!”
Christian, who at the end had been walking up and down in the
room, at last forsook the field.
“Very good, we shall see!” he shouted. With his eyes red, his
moustaches ruffled, his handkerchief in his hand, his coat wide
open, hot and beside himself, he went out of the door and slammed
it behind him.
In the sudden stillness the Senator stood for a moment upright and
gazed after his brother. Then he sat down without a word and took
up the papers jerkily. He went curtly through the remaining
business, then leaned back and twisted his moustaches through his
fingers, lost in thought.
Frau Permaneder’s anxiety made her heart beat loudly. The question,
the great question, could now not be put off any longer. It must
come up, and he must answer; but was her brother now in a mood
to be governed by gentleness and filial piety? Alas, she feared not.
“And—Tom—,” she began, looking down into her lap, and then up, as
she made a timid effort to read his thoughts. “The furniture—you
have taken everything into consideration of course—the things that
belong to us, I mean to Erica and me and the little one, they remain
here with us? In short, the house—what about it?” she finished, and
furtively wrung her hands.
The Senator did not answer at once. He went on for a while twisting
his moustaches and drearily meditating. Then he drew a deep breath
and sat up.
“The house?” he said. “Of course it belongs to all of us, to you and
me, and Christian—and, queerly enough, to Pastor Tiburtius too. I
can’t decide anything about it by myself. I have to get your consent.
But obviously the thing to do is to sell as soon as possible,” he
concluded, shrugging his shoulders. Yet something crossed his face,
after all, as though he were startled by his own words.
Frau Permaneder’s head sank deep on her breast; her hands
stopped pressing themselves together; she relaxed all over.
“Our consent,” she repeated after a pause, sadly, and rather bitterly
as well. “Dear me, Tom, you know you will do whatever you think
best—the rest of us are not likely to withhold our consent for long.
But if we might put in a word—to beg you,” she, went on, almost
dully, but her lip was trembling too—“the house—Mother’s house—
the family home, in which we have all been so happy! We must sell
it—?”
The Senator shrugged his shoulders again. “Child, you will believe
me when I tell you that I feel everything you can say, as much as
you do yourself. But those are only our feelings; they aren’t actual
objections. What has to be done, remains the problem. Here we
have this great piece of property—what shall we do with it? For
years back, ever since Father’s death, the whole back part has been
going to pieces. A family of cats is living rent-free in the billiard-
room, and you can’t walk there for fear of going through the floor.
Of course, if I did not have my house in Fishers’ Lane— But I have,
and what should I do with it? Do you think I might sell that instead?
Tell me yourself, to whom? I should lose half the money I put into it.
We have property enough, Tony; we have far too much, in fact. The
granary buildings, and two great houses. The invested capital is out
of all proportion to the value of the property. No, no, we must sell.”
But Frau Permaneder was not listening. She was sitting bent over on
the sofa, withdrawn into herself with her own thoughts.
“Our house,” she murmured. “I remember the housewarming. We
were no bigger than that. The whole family was there. And Uncle
Hoffstede read a poem. It is in the family papers. I know it by heart.
Venus Anadyomene. The landscape-room. The dining-hall! And
strange people—!”
“Yes, Tony. They must have felt the same—the family of whom
Grandfather bought the house. They had lost their money and had
to give up their home, and they are all dead and gone now.
Everything has its time. We ought to be grateful to God that we are
better off than the Ratenkamps, and are not saying good-bye to the
house under such sorry circumstances as theirs.”
Sobs, long, painful sobs, interrupted him. Frau Permaneder so
abandoned herself to her grief that she did not even dry the tears
that ran down her cheeks. She sat bent over, and the warm drops
fell unheeded upon the hands lying limp in her lap.
“Tom,” said she, and there was a gentle, touching decision in her
voice, which, a moment before her sobs had threatened to choke,
“you can’t understand how I feel at this hour—you cannot
understand your sister’s feelings! Things have not gone well with her
in this life.—I have had everything to bear that fate could think of to
inflict upon me. But I have borne it all without flinching, Tom: all my
troubles with Grünlich and Permaneder and Weinschenk. For,
however my life seemed to go awry, I was never quite lost. I had
always a safe haven to fly to. Even this last time, when everything
came to an end, when they took away Weinschenk to prison,
‘Mother,’ I said, ‘may we come to you?’ And she said, ‘Yes, my
children, come!’ Do you remember, Tom, when we were little, and
played war, there was always a little spot marked off for us to run to,
where we could be safe and not be touched until we were rested
again? Mother’s house, this house, was my little spot, my refuge in
life, Tom. And now—it must be sold—”
She leaned back, buried her face in her handkerchief, and wept
unrestrainedly.
He drew down one of her hands and held it in his own.
“I know, dear Tony, I know it all. But we must be sensible. Our dear
good Mother is gone. We cannot bring her back. And so— It is
madness to keep the house as dead capital. Shall we turn it into a
tenement-house? I know it is painful to think of strangers living
here; but after all it is better you should not see it. You must take a
nice, pretty little house or flat somewhere for yourself and your
family—outside the Castle Gate, for example. Or would you rather
stop on here and let out floors to different families? And you still
have the family: Gerda and me, and the Buddenbrooks in Broad
Street, and the Krögers, and Therese Weichbrodt, and Clothilde—
that is, if Clothilde will condescend to associate with us, now that
she’s become a lady of the Order of St. John—it’s so very exclusive,
you know!”
She gave a sigh that was already partly a laugh, and mopped her
eyes with her handkerchief, looking like a hurt child whom somebody
is helping, with a jest, to forget its pain. Then she resolutely cleared
her face and put herself to rights, tossing her head with the
characteristic gesture and bringing her chin down on her breast.
“Yes, Tom,” she said, and blinked with her tear-reddened eyes, “I’ll
be good now; I am already. You must forgive me—and you too,
Gerda—for breaking down like that. But it may happen to any one,
you know. It is a weakness. But, believe me, it is only outward. I am
a woman steeled by misfortunes. And that about the dead capital is
very convincing to me, Tom—I’ve enough intelligence to understand
that much, anyhow. I can only repeat that you must do what you
think best. You must think and act for us all; for Gerda and I are
only women, and Christian—well, God help him, poor soul! We
cannot oppose you, for whatever we could say would be only
sentiment, not real objections, it is very plain. To whom will you sell
it, Tom? Do you think it will go off right away?”
“Ah, child—how do I know? But I talked a little this morning with old
Gosch the broker; he did not seem disinclined to undertake the
business.”
“That is a good idea, Tom. Siegismund Gosch has his weaknesses, of
course. That thing about his translation from the Spanish—I can’t
remember the man’s name, but it is very odd, one must admit.
However, he was Father’s friend, and he is an honest man through
and through.—What shall you ask? A hundred thousand marks would
be the least, I should think.”
And “A hundred thousand marks would be the least, wouldn’t it,
Tom?” she was still asking, the door-knob in her hand, as the
Senator and his wife went down the steps. Then she was alone, and
stood there in the middle of the room with her hands clasped palms
down in front of her, looking all around with large, helpless eyes. Her
head, heavy with the weight of her thoughts, adorned with the little
black lace cap, sank slowly, shaking all the while, deeper and deeper
on one shoulder.
CHAPTER III
Little Johann was to go to take his farewell of his grandmother’s
mortal remains. His father so arranged it, and, though Hanno was
afraid, he made not a syllable of objection. At table, the day after
the Frau Consul’s dying struggle, the Senator, in his son’s presence
and apparently with design, had commented harshly upon the
conduct of Uncle Christian, who had slipped away and gone to bed
when the patient’s suffering was at its height. “That was his nerves,
Thomas,” Gerda had answered. But with a glance at Hanno, which
had not escaped the child, the Senator had severely retorted that an
excuse was not in place. The agony of their departed mother had
been so sore that one had felt ashamed even to be sitting there free
from pain—not to mention entertaining the cowardly thought of
trying to escape any suffering of mind called up by the sight. From
which, Hanno had gathered that it would not be safe to object to the
visit to the open coffin.
The room looked as strange to him as it had at Christmas, when, on
the day before the funeral, between his father and his mother, he
entered it from the hall. There was a half-circle of potted plants,
arranged alternately with high silver candelabra; and against the
dark green leaves gleamed from a black pedestal the marble copy of
Thorwaldsen’s Christ, which belonged in the corridor outside. Black
crape hangings fluttered everywhere in the draught, hiding the sky-
blue tapestries and the smiling immortals who had looked down
from these walls upon so many festive dinner-tables. Little Johann
stood beside the bier among his black-clad relatives. He had a broad
mourning band on his own sailor suit, and his senses felt misty with
the scent from countless bouquets and wreaths—and with another
odour that came wafted now and then on a current of air, and
smelled strange, yet somehow familiar.
He stood beside the bier and looked at the motionless white figure
stretched out there severe and solemn, amid white satin. This was
not Grandmamma. There was her Sunday cap with the white silk
ribbons, and her red-brown hair beneath it. But the pinched nose
was not hers, nor the drawn lips, nor the sharp chin, nor the yellow,
translucent hands, whose coldness and stiffness one could see. This
was a wax-doll—to dress it up and lay it out like that seemed rather
horrible. He looked across to the landscape-room, as though the real
Grandmamma might appear there the next minute. But she did not
come: she was dead. Death had turned her for ever into this wax
figure that kept its lids and lips so forbiddingly closed.
He stood resting on his left leg, the right knee bent, balancing lightly
on the toe, and clutched his sailor knot with one hand, the other
hanging down. He held his head on one side, the curly light-brown
locks swaying over the temples, and looked with his gold-brown,
blue-encircled eyes in brooding repugnance upon the face of the
dead. His breath came long and shuddering, for he kept expecting
that strange, puzzling odour which all the scent of the flowers
sometimes failed to disguise. When the odour came, and he
perceived it, he drew his brows still more together, his lip trembled,
and the long sigh which he gave was so like a tearless sob that Frau
Permaneder bent over and kissed him and took him away.
And after the Senator and his wife, and Frau Permaneder and Erica,
had received for long hours the condolences of the entire town,
Elisabeth Buddenbrook, born Kröger, was consigned to earth. The
out-of-town families, from Hamburg and Frankfort, came to the
funeral and, for the last time, received hospitality in Meng Street.
And the hosts of the sympathizers filled the hall and the landscape-
room, the corridor and the pillared hall; and Pastor Pringsheim of St.
Mary’s, erect among burning tapers at the head of the coffin, turning
his face up to heaven, his hands folded beneath his chin, preached
the funeral sermon.
He praised in resounding tones the qualities of the departed: he
praised her refinement and humility, her piety and cheer, her
mildness and her charity. He spoke of the Jerusalem evenings and
the Sunday-school; he gilded with matchless oratory the whole long
rich and happy earthly course of her who had left them; and when
he came to the end, since the word “end” needed some sort of
qualifying adjective, he spoke of her “peaceful end.”
Frau Permaneder was quite aware of the dignity, the representative
bearing, which she owed to herself and the community in this hour.
She, her daughter Erica, and her granddaughter Elisabeth occupied
the most conspicuous places of honour, close to the pastor at the
head of the coffin; while Thomas, Gerda, Clothilde, and little Johann,
as likewise old Consul Kröger, who had a chair to sit in, were
content, as were the relatives of the second class, to occupy less
prominent places. Frau Permaneder stood there, very erect, her
shoulders elevated, her black-bordered handkerchief between her
folded hands; and her pride in the chief rôle which it fell to her lot to
perform was so great as sometimes entirely to obscure her grief.
Conscious of being the focus of all eyes, she kept her own discreetly
cast down; yet now and again she could not resist letting them stray
over the assembly, in which she noted the presence of Julchen
Möllendorpf, born Hagenström, and her husband. Yes, they had all
had to come: Möllendorpfs, Kistenmakers, Langhals, Överdiecks—
before Tony Buddenbrook left her parental roof for ever, they had all
gathered here, to offer her, despite Grünlich, despite Permaneder,
despite Hugo Weinschenk, their sympathy and condolences.
Pastor Pringsheim’s sermon went on, turning the knife in the wound
that death had made: he caused each person present to remember
his own dead, he knew how to make tears flow where none would
have flowed of themselves—and for this the weeping ones were
grateful to him. When he mentioned the Jerusalem evenings, all the
old friends of the dead began to sob—excepting Madame Kethelsen,
who did not hear a word he said, but stared straight before her with
the remote air of the deaf, and the Gerhardt sisters, the descendants
of Paul, who stood hand in hand in a corner, their eyes glowing.
They were glad for the death of their friend, and could have envied
her but that envy and unkindness were foreign to their natures.
Poor Mademoiselle Weichbrodt blew her nose all the time, with a
short, emphatic sound. The Misses Buddenbrook did not weep. It
was not their habit. Their bearing, less angular than usual,
expressed a mild satisfaction with the impartial justice of death.
Pastor Pringsheim’s last “amen” resounded, and the four bearers, in
their black three-cornered hats, their black cloaks billowing out
behind them with the swiftness of their advance, came softly in and
put their hands upon the coffin. They were four lackeys, known to
everybody, who were engaged to hand the heavy dishes at every
large dinner in the best circles, and who drank Möllendorpf’s claret
out of the carafes, between the courses. But, also, they were
indispensable at every funeral of the first or second class, being of
large experience in this kind of work. They knew that the harshness
of this moment, when the coffin was laid hold upon by strange
hands and borne away from the survivors, must be ameliorated by
tact and swiftness. Their movements were quick, agile, and
noiseless; hardly had any one time to be sensible of the pain of the
situation, before they had lifted the burden from the bier to their
shoulders, and the flower-covered casket swayed away smoothly
and with decorum through the pillared hall.
The ladies pressed tenderly about Frau Permaneder and her
daughter to offer their sympathy. They took her hand and
murmured, with drooping eyes, precisely no more and no less than
what on such occasions must be murmured; while the gentlemen
made ready to go down to the carriages.
Then came, in a long, black procession, the slow drive through the
grey, misty streets out through the Burg Thor, along the leafless
avenue in a cold driving rain, to the cemetery, where the funeral
march sounded behind half-bare shrubbery on the edge of the little
grove, and the great sandstone cross marked the Buddenbrook
family lot. The stone lid of the grave, carven with the family arms,
lay close to the black hole framed in dripping greens.
A place had been prepared down below for the new-comer. In the
last few days, the Senator had supervised the work of pushing aside
the remains of a few early Buddenbrooks. The music sounded, the
coffin swayed on the ropes above the open depth of masonry; with a
gentle commotion it glided down. Pastor Pringsheim, who had put
on pulse-warmers, began to speak afresh, his voice ringing fervid
and emotional above the open grave. He bent over the grave and
spoke to the dead, calling her by her full name, and blessed her with
the sign of the cross. His voice ceased; all the gentlemen held their
top-hats in front of their faces with their black-gloved hands; and the
sun came out a little. It had stopped raining, and into the sound of
the single drops that fell from the trees and bushes there broke now
and then the short, fine, questioning twitter of a bird.
All the gentlemen turned a moment to press the hands of the sons
and brother of the dead once more.
Thomas Buddenbrook, as the others filed by, stood between his
brother Christian and his uncle Justus. His thick dark woollen
overcoat was dewed with fine silver drops. He had begun of late to
grow a little stout, the single sign of age in his carefully preserved
exterior, and his cheeks, behind the pointed protruding ends of his
moustaches, looked rounder than they used; but it was a pale and
sallow roundness, without blood or life. He held each man’s hand a
moment in his own, and his slightly reddened eyes looked them all,
with weary politeness, in the face.
CHAPTER IV
A week later there sat in Senator Buddenbrook’s private office, in the
leather chair beside the writing-desk, a little smooth-shaven old man
with snow-white hair falling over his brow and temples. He sat in a
crouching position, supporting both hands on the white top of his
crutch-cane, and his pointed chin on his hands; while he directed at
the Senator a look of such malevolence, such a crafty, penetrating
glance, that one wondered why the latter did not avoid contact with
such a man as this. But the Senator sat apparently at ease, leaning
back in his chair, talking to this baleful apparition as to a harmless
ordinary citizen. Broker Siegismund Gosch and the head of the firm
of Johann Buddenbrook were discussing the price of the Meng Street
house.
It took a long time. The offer of twenty-eight thousand thaler made
by Herr Gosch seemed too low to the Senator, and the broker called
heaven to witness that it would be an act of madness to add a single
groschen to the sum. Thomas Buddenbrook spoke of the central
position and unusual extent of the property; but Herr Gosch, with
picturesque gestures, in low and sibilant tones, expatiated upon the
criminal risk he would be running. He waxed almost poetic. Ha!
Could his honoured friend tell him when, to whom, for how much,
he would be able to get rid of the house again? How often, in the
course of the century, would there be a demand for such a house?
Perhaps his friend and patron could assure him that to-morrow, on
the train from Buchen, there was arriving an Indian nabob who
wished to establish himself in the Buddenbrook mansion? He,
Siegismund Gosch, would have it on his hands, simply on his hands,
and it would be the ruin of him. He would be a beaten man, his race
would be run, his grave dug—yes, it would be dug—and, as the
phrase enchanted him, he repeated it, and added something more
about chattering apes and clods of earth falling upon the lid of his
coffin.
But the Senator was not satisfied. He spoke of the ease with which
the property could be divided, emphasized his responsibility toward
his sister, and remained by the sum of thirty thousand thaler. After
which he had to listen, with a mixture of enjoyment and impatience,
to a rejoinder from Herr Gosch, which lasted some two hours, during
which the broker sounded, as it were, all the registers of his
character. He played two rôles at once: first, the hypocritical villain,
with a sweet voice, his head on one side, and a smile of open-
hearted simplicity. Stretching out his large, white hand, with the
long, trembling fingers, he said “Agree, my dear young patron:
eighty-four thousand marks—it is the offer of an honest old man.”
But a child could have seen that this was all lies and treachery—a
deceiving mask, behind which the man’s deep villainy peeped forth.
Thomas Buddenbrook finally declared that he must take time to
think, and that in any case he must consult his sister, before he
accepted the twenty-eight thousand thaler—which was unlikely.
Then he turned the conversation to indifferent topics and asked Herr
Gosch about business and his health.
Things were going badly with Herr Gosch. He made a fine, sweeping
gesture to wave away the imputation that he was a prosperous man.
The burdens of old age approached, they were at hand even now;
as aforesaid, his grave was dug. He could not even carry his glass of
grog to his lips without spilling half of it, his arm trembled so like the
devil. It did no good to curse. The will no longer availed. And yet—!
He had his life behind him—not such a poor life, after all. He had
looked at the world with his eyes open. Revolutions had thundered
by, their waves had beat upon his heart—so to speak. Ha! Those
were other times, when he had stood at the side of Consul Johann
Buddenbrook, the Senator’s father, at that historic sitting, and defied
the fury of the raging mob. A frightful experience! No, his life had
not been poor, either outwardly or inwardly. Hang it—he had been
conscious of powers—and as the power is, so is the ideal—as
Feuerbach says. And even now—even now, his soul was not
impoverished, his heart was still young: it had never ceased, and
would never cease, to be capable of great emotions, to live fervently
in and for his ideals. They would go with him to his grave.—But were
ideals, after all, meant to be realized? No, a thousand times no! We
might long for the stars, but should we ever reach them? No, hope,
not realization, was the most beautiful thing in life: “L’espérance,
tout trompeuse qu’elle est, sert au moins à nous mener à la fin de la
vie par un chemin agréable.” La Rochefoucauld said that, and it was
fine, wasn’t it? Oh, yes, his honoured friend and patron, of course,
did not need to console himself with that sort of thing. The waves of
life had lifted him high on their shoulders, and fortune played about
his brow. But for the lonely and submerged, who dreamed alone in
the darkness—
Suddenly—“You are happy,” he said, laying his hand on the Senator’s
knee, and looking up at him with swimming eyes. “Don’t deny it—it
would be sacrilege. You are happy. You hold fortune in your arms.
You have reached out your strong arms and conquered her—your
strong hands,” he corrected himself, not liking the sound of “arms”
twice so close together. He was silent, and the Senator’s
deprecating, patient reply went unheard. He seemed to be darkly
dreaming for a moment; then he got up.
“We have been chatting,” he said, “but we came together on
business. Time is money. Let us not waste it in hesitation. Listen to
me. Since it is you: since it is you, you understand—” here it almost
looked as though Herr Gosch was about to give way again to
another rhapsody; but he restrained himself. He made a wide,
sweeping gesture, and cried: “Twenty-nine thousand thaler, eighty-
seven thousand marks current, for your mother’s house! Is it a
bargain?” And Senator Buddenbrook agreed.
Frau Permaneder, of course, found the sum ridiculously small.
Considering the memories that clung about it, she would have
thought a million down no more than an honest price for their old
home. But she rapidly adjusted herself—the more readily that her
thoughts and efforts were soon taken up by plans for the future.
She rejoiced from the bottom of her heart over all the good furniture
that had fallen to her share. And though there was no idea of
bustling her away from under the parental roof, she plunged at
once, with the greatest zest, into the business of finding and renting
a new home. The leave-taking would be hard—the very thought of it
brought tears to her eyes. But the prospect of a change was not
without its own charm too. It was almost like another setting-out—
the fourth one! And so again she looked at houses and visited
Jacob’s; again she bargained for portières and stair-carpets. And
while she did all that, her heart beat faster—yes, even the heart of
this old woman who was steeled by the misfortunes of life!
Weeks passed like this: four, five, six weeks. The first snow fell, the
stoves crackled. Winter was here again; and the Buddenbrooks
began to consider sadly what sort of Christmas feast they should
have this year. But now something happened: something surprising
and dramatic beyond all words, something that simply knocked you
off your feet. Frau Permaneder paused in the midst of her business,
like one paralyzed.
“Thomas,” she said, “am I crazy? Is Gosch dreaming? It is too
absurd, too outlandish—” She held her temples with both her hands.
The Senator shrugged his shoulders.
“My dear child, nothing at all is decided yet. But there is the
possibility—and if you think it over quietly, you will see that there is
nothing so extraordinary about it, after all. It is a little startling, I
admit. It gave me a start when Gosch first told me. But absurd?
What makes it absurd?”
“I should die,” said she. She sat down in a chair and stopped there
without moving.
What was going on? Simply that a buyer had appeared for the
house; or, rather, a possible purchaser showed a desire to go over it,
with a view to negotiations. And this possible purchaser was—
Hermann Hagenström, wholesale dealer and Consul for the Kingdom
of Portugal.
When the first rumour reached Frau Permaneder, she was stunned,
incredulous, incapable of grasping the idea. But when the rumour
became concrete, when it actually took shape in the person of
Consul Hermann Hagenström, standing, as it were, before the door,
then she pulled herself together, and animation came back to her.
“This must not happen, Thomas. As long as I live, it must not
happen. When one sells one’s house, one is bound to look out for
the sort of master it gets. Our Mother’s house! Our house! The
landscape-room!”
“But what stands in the way?”
“What stands in the way? Heavens, Thomas! Mountains stand in the
way—or they ought to! But he doesn’t see them, this fat man with
the snub nose! He doesn’t care about them. He has no delicacy and
no feeling—he is like the beasts that perish. From time immemorial
the Hagenströms and we have been rivals. Old Heinrich played
Father and Grandfather some dirty tricks; and if Hermann hasn’t
tripped you up yet, it is only because he hasn’t had a chance. When
we were children, I boxed his ears in the open street, for very good
reasons; and his precious little sister Julchen nearly scratched me to
pieces for it. That was all childishness, then. But they have always
looked on and enjoyed it whenever we had a piece of bad luck—and
it was mostly I myself who gave them the pleasure. God willed it so.
Whatever the Consul did to injure you or overreach you in a
business way, that I can’t speak of, Tom. You must know better than
I. But the last straw was when Erica made a good marriage and he
wormed around and wormed around until he managed to spoil it and
get her husband shut up, through his brother, who is a cat! And now
they have the nerve—”
“Listen, Tony. In the first place, we have nothing more to say in the
matter. We made our bargain with Gosch, and he has the right to
deal with whomever he likes. But there is a sort of irony about it,
after all—”
“Irony? Well, if you like to call it that—but what I call it is a disgrace,
a slap in the face; because that is just what it would be. You don’t
realize what it would be like, in the least. But it would mean to
everybody that the Buddenbrook family are finished and done for:
they clear out, and the Hagenströms squeeze into their place,
rattlety-bang! No, Thomas, never will I consent to sit by while this
goes on. I will never stir a finger in such baseness. Let him come
here if he dares. I won’t receive him, you may be sure of that. I will
sit in my room with my daughter and my granddaughter, and turn
the key in the door, and forbid him to enter.—That is just what I will
do.”
“I know, Tony, you will do what you think best; and you will probably
consider well beforehand if it will be wise not to preserve the
ordinary social forms. For of course you don’t imagine that Consul
Hagenström would feel wounded by your conduct? Not in the least,
my child. It would neither please nor displease him—he would
simply be mildly surprised, that is all. The trouble is, you imagine he
has the same feelings toward you that you have toward him. That is
a mistake, Tony. He does not hate us in the least. He doesn’t hate
anybody. He is highly successful and extremely good-natured. As
I’ve told you more than ten times already, he would speak to you on
the street with the utmost cordiality if you didn’t put on such a
belligerent air. I’m sure he is surprised at it—for two minutes; of
course not enough to upset the equilibrium of a man to whom
nobody can do any harm. What is it you reproach him with? Suppose
he has outstripped me in business, and even now and then got
ahead of me in some public affair? That only means he is a better
business man and a cleverer politician than I am.—There’s no reason
at all for you to laugh in that scornful way.—But to come back to the
house. The truth is, it has lost most of its old significance for us—
that has gradually passed over to mine. I say this to console you in
advance; on the other hand, it is plain why Consul Hagenström is
thinking of buying. These people have come up in the world, their
family is growing, they have married into the Möllendorpf family, and
become equal to the best in money and position. But so far, there
has been something lacking, the outward sign of their position,
which they were evidently willing to do without: the historic
consecration—the legitimization, so to speak. But now they seem to
have made up their minds to have that too; and some of it they will
get by moving into a house like this one. You wait and see: mark my
words, the Consul will preserve everything as much as possible as it
is, he will even keep the ‘Dominus providebit’ over the door—though,
to do him justice, it hasn’t been the Lord at all, but Hermann
Hagenström himself, single-handed, that has put the family and the
firm where they are!”
“Bravo, Tom! Oh, it does do me good to hear you say something
spiteful about them once in a while! That’s really all I want! Oh, if I
only had your head! Wouldn’t I just give it to him! But there you
stand—”
“You see, my head doesn’t really do me much good.”
“There you stand, I say, with that awful calmness, which I simply
don’t understand at all, and tell me how Hermann Hagenström does
things. Ah, you may talk as you like, but you have a heart in your
body, the same as I have myself, and I simply don’t believe you feel
as calm inside as you make out. All the things you say are nothing
but your own efforts to console yourself.”
“Now, Tony, you are getting pert. What I do is all you have anything
to do with—what I think is my own affair.”
“Tell me one thing, Tom: wouldn’t it be like a nightmare to you?”
“Exactly.”
“Like something you dreamed in a fever?”
“Why not?”
“Like the most ridiculous kind of farce?”
“There, there, now, that’s enough!”
And Consul Hagenström appeared in Meng Street, accompanied by
Herr Gosch, who held his Jesuit hat in his hand, crouched over like a
conspirator, and peered past the maid into the landscape-room even
while he handed her his card.
Hermann Hagenström looked the City man to the life: an imposing
Stock Exchange figure, in a coat the fur of which seemed a foot
long, standing open over an English winter suit of good fuzzy yellow-
green tweed. He was so uncommonly fat that not only his chin, but
the whole lower part of his face, was double—a fact which his full
short-trimmed blond beard could not disguise. When he moved his
forehead or eyebrows, deep folds came even in the smoothly shorn
skin of his skull. His nose lay flatter upon his upper lip than ever, and
breathed down into his moustaches. Now and then his mouth had to
come to the rescue and fly open for a deep breath. When it did this
it always made a little smacking noise, as the tongue came away
from the roof of his mouth.
Frau Permaneder coloured when she heard this once well-known
sound. A vision of lemon-buns with truffled sausage on top, almost
threatened, for a moment, the stony dignity of her bearing. She sat
on the sofa, her arms crossed and her shoulders lifted, in an
exquisitely fitting black gown with flounces up to the waist, and a
dainty mourning cap on her smooth hair. As the two gentlemen
entered, she made a remark to her brother the Senator, in a calm,
indifferent tone. He had not had the heart to leave her in the lurch
at this hour; and he now walked to the middle of the room to meet
their guests, while Tony remained on the sofa. He exchanged a
hearty greeting with Herr Gosch and a correct and courteous one
with the Consul; then Tony rose of her own accord, performed a
measured bow to both of them at once, and, without any excess of
zeal, associated herself with her brother’s invitation to the two
gentlemen to be seated.
They all sat down, and the Consul and the broker talked by turns for
the next few minutes. Herr Gosch’s voice was offensively obsequious
as he begged them to pardon the intrusion on their privacy—you
could hear a malign undercurrent in it none the less—but Herr
Consul Hagenström was anxious to go through the house with a
view to possible purchase. And the Consul, in a voice that again
called up visions of lemon-bun and goose-liver, said the same thing
in different words. Yes, in fact, this was the idea he had in mind and
hoped to be able to carry out—provided the broker did not try to
drive too hard a bargain with him, ha, ha! He did not doubt but the
matter could be settled to the satisfaction of everybody concerned.
His manner was free and easy and like a man of the world’s, which
did not fail to make a certain impression on Madame Permaneder;
the more so that he nearly always turned to her as he spoke. His
tone was almost apologetic when he went into detail upon the
grounds for his desire to purchase. “Room!” he said. “We need more
room. My house in Sand Street—you wouldn’t believe it, my dear
madam, nor you, Herr Senator, but in fact, it is getting so small we
can’t turn round in it. I’m not speaking of company. It only takes the
family, and the Huneus, and the Möllendorpfs and my brother
Moritz’s family, and there we are—in fact, packed in like sardines. So,
then—well, why should we, you know!”
He spoke in an almost fretful tone, while manner and gestures
expressed: “You see for yourselves, there’s no reason why I should
put up with that sort of thing, when there is plenty of money to do
what we like!”
“I thought of waiting,” he went on, “till Zerline and Bob should want
a house. Then they could take mine, and I could find something
larger for myself. But in fact—you know,” he interrupted himself, “my
daughter Zerline has been engaged to Bob, my brother the
attorney’s eldest, for years. The wedding won’t be put off much
longer—two years at most. They are young—so much the better.
Well—in fact—why should I wait for them and let slip a good chance
when it offers? There would be no sense in that.”
Everybody agreed. The conversation paused for a while on the
subject of the approaching wedding. Marriages—advantageous
marriages—between first cousins were not uncommon in the town,
and this one excited no disapproval. The plans of the young pair
were inquired into—with reference to the wedding journey. They
thought of going to the Riviera, to Nice and so on. That was what
they seemed to want to do—and why shouldn’t they, you know? The
younger children were mentioned, and the Consul spoke of them
with easy satisfaction, shrugging his shoulders. He himself had five
children, and his brother Moritz had four sons and daughters. Yes,
they were all flourishing, thanks. Why shouldn’t they be,—you know?
In fact, they were all very well. And he came back to the growing up
of the family, and to their narrow quarters. “Yes, this is something
else entirely,” he said. “I’ve seen that already, on the way upstairs.
This house is a pearl, certainly a pearl—if you can compare anything
so large with anything so small, ha, ha! Why, even the hangings
here—I own up to having had my eye on the hangings all the time
I’ve been talking. A most charming room—in fact. When I think that
you have passed all your life in these surroundings—in fact—”
“With some interruptions,” said Frau Permaneder, in that
extraordinarily throaty voice of which she sometimes availed herself.
“Oh, yes, interruptions,” repeated the Consul, with a civil smile. Then
he glanced at Senator Buddenbrook and the broker; and, as those
gentlemen were in conversation together, he drew up his chair to
Frau Permaneder’s sofa and leaned toward her, so that she felt his
heavy breathing close under her nose. Being too polite to turn away,
she sat as stiff and erect as possible and looked down at him under
her drooping lids. But he was quite unconscious of her discomfort.
“Let me see, my dear Madame Permaneder,” he said. “Seems to me
we’ve done business together before now. In fact—what was it we
were dickering over then? Sweetmeats, wasn’t it, or tit-bits of some
sort—and now a whole house!”
“I don’t remember,” said Frau Permaneder. She held her neck as stiff
as she could, for his face was really disgustingly, indecently near.
“You don’t remember?”
“No, really, I don’t remember anything at all about sweetmeats. I
have a sort of hazy recollection of lemon-buns, with sausage on top
—some disgusting sort of school luncheon—I don’t know whether it
was yours or mine. We were all children then.—But this matter of
the house is entirely Herr Gosch’s affair. I have nothing to do with it.”
She gave her brother a quick, grateful look, for he had seen her
need and come to her rescue by asking if the gentlemen were ready
to make the round of the house. They were quite ready, and took
temporary leave of Frau Permaneder, expressing the hope of seeing
her again when they had finished. The Senator led the two
gentlemen out through the dining-room.
He took them upstairs and down, and showed them the rooms in the
second storey as well as those on the corridor of the first, and the
ground floor, including the kitchen and cellars. As the visit fell in
business hours, they refrained from visiting the offices of the
Insurance Company. But the new Director was mentioned, and
Consul Hagenström declared him to be a very honest chap—a
remark which was received by the Senator in silence.
They went through the garden, lying bare and wretched under half-
melting snow, looked at the Portal, and returned to the laundry, in
the front courtyard; and thence by the narrow paved walk that led
between walls to the back courtyard with the oak-tree, and the
“back-building.” Here there was nothing but old age, neglect, and
dilapidation. Grass and moss grew between the paving-stones, the
steps were in a state of advanced decay, and they could only look
into the billiard-room without entering,—the floor was so bad—so
the family of cats that lived there rent-free was not disturbed.
Consul Hagenström said very little—he was obviously planning.
“Well, yes,” he kept saying, as he looked and turned away,
suggesting by his manner that in case he bought the house all this
would of course be different. He stood, with the same air, on the
ground floor of the back building and looked up at the empty attic.
“Yes, well,” he repeated, and set in motion the thick, rotting cable
with a rusty iron hook on the end that had been hanging there for
years. Then he turned on his heel.
“Best thanks for your trouble, Herr Senator,” he said. “We’re at the
end, I suppose.” He scarcely uttered a word on the rapid return to
the front building, or later when the two gentlemen paid their
respects to Frau Permaneder in the landscape-room and the Senator
accompanied them down the steps and across the entry. But hardly
had they said good-bye and Consul Hagenström turned with his
companion to walk down the street, when it was seen that a very
lively conversation began at once between the two.
The Senator returned to the room where Frau Permaneder, with her
severest manner, sat bolt upright in the window, knitting with two
huge wooden needles a black worsted frock for her granddaughter
Elisabeth, and now and then casting a glance into the gossip’s glass.
Thomas walked up and down a while in silence, with his hands in his
trousers pockets.
“Yes, we have put it in the broker’s hands,” he said at length. “We
must wait and see what comes of it. My opinion is that he will buy
the whole property, live here in the front, and utilize the back part in
some other way.”
She did not look at him, or change her position, or cease to knit. On
the contrary, the needles flew back and forth faster than ever.
“Oh, certainly—of course he’ll buy it. He’ll buy the whole thing,” she
said, and it was her throaty voice she used. “Why shouldn’t he buy it
—you know? In fact, there would be no sense in that at all!”
She raised her eyebrows and looked severely through her pince-nez
—which she now used for sewing, but never managed to put on
straight—at her knitting-needles. They flew like lightning round and
round each other, clacking all the while.

Christmas came: the first Christmas without the Frau Consul. They
spent the evening of the twenty-fourth at the Senator’s house,
without the old Krögers and without the Misses Buddenbrook; for
the old children’s day had now ceased to exist, and Thomas
Buddenbrook did not feel like making presents to everybody who
used to attend the Frau Consul’s celebration. Only Frau Permaneder
and Erica, with little Elisabeth, Christian, Clothilde, and Mademoiselle
Weichbrodt, were invited. The latter insisted on holding the
customary present-giving on the twenty-fifth, in her own stuffy little
rooms, where it was attended with the usual mishap.
There was no troop of poor retainers to receive shoes and woollen
underwear, and there were no choir-boys, when they assembled in
Fishers’ Lane on the twenty-fourth. They joined quite simply
together in “Holy Night,” and Therese Weichbrodt read the Christmas
chapter instead of the Frau Senator, who did not particularly care for
such things. Then they went through the suite of rooms into the
hall, singing in a subdued way the first stanza of “O Evergreen.”
There was no special ground for rejoicing. Nobody’s face was
beaming with joy, there was no lively conversation. What was there
to talk about? They thought of the departed mother, discussed the
sale of the house and the well-lighted apartment which Frau
Permaneder had rented in a pleasant house outside Holsten Gate,
with a view on the green square of Linden Place, and what would
happen when Hugo Weinschenk came out of prison. At intervals little
Johann played on the piano something which he had been learning
with Herr Pfühl, or accompanied his mother, not faultlessly, but with
a lovely singing tone, in a Mozart sonata. He was praised and kissed,
but had to be taken off to bed by Ida Jungmann, for he was pale
and tired on account of a recent stomach upset.
Even Christian was disinclined to talk or joke. After the violent
altercation in the breakfast-room he had not let fall another syllable
about getting married. He lived on in the old way, on terms with his
brother which were not very honourable to himself. He made a brief
effort, rolling his eyes about, to awaken sympathy in the company
for the misery in his side; went early to the club; and came back to
supper, which was held after the prescribed traditions. And then the
Buddenbrooks had this Christmas too behind them, and were glad of
it.
In the beginning of the year 1872, the household of the deceased
Frau Consul was broken up. The servants went, and Frau
Permaneder thanked God to see the last of Mamsell Severin, who
had continued to question her authority in the most unpleasant
manner, and now departed with the silk gowns and linen which she
had accumulated. Furniture wagons stood before the door, and the
old house was emptied of its contents. The great carved chest, the
gilt candelabra, and the other things that had fallen to his share, the
Senator took to his house in Fishers’ Lane; Christian moved with his
into a three-room bachelor apartment near the club; and the little
Permaneder-Weinschenk family took possession with theirs of the
well-lighted flat in Linden Place, which was after all not without
some claims to elegance. It was a pretty little apartment, and the
front door of it had a bright copper plate with the name A.
Permaneder-Buddenbrook, Widow, in ornamental lettering.
The house in Meng Street was hardly emptied when a host of
workmen appeared and began to tear down the back-building; the
dust from the old mortar darkened the air. The property had passed
into the hands of Consul Hermann Hagenström. He had set his heart
upon it, and had outbid an offer which Sigmund Gosch received for it
from Bremen. He immediately began to turn it to the best
advantage, in the ingenious way for which he had been so long
admired. In the spring he moved with his family into the front
house, where he left everything almost untouched, save for the
necessary renovations and certain very modern improvements. For
instance, he had the old bell-pulls taken out and the house fitted
throughout with electric bells. And hardly had the back-building been
demolished when a new, neat, and airy structure rose in its place,
which fronted on Bakers’ Alley and was intended for shops and
warehouses.
Frau Permaneder had frequently sworn to her brother that no power
on earth could bring her ever to look at the parental home again.
But it was hardly possible to carry out this threat. Her way
sometimes led her of necessity past the shops which had been
quickly and advantageously rented, and past the show-windows of
the back-building, or the dignified gable front on the other side,
where now, beneath the “Dominus Providebit,” was to be read the
name of Consul Hermann Hagenström. When she saw that, Frau
Permaneder, on the open street, before ever so many people, simply
began to weep aloud. She put back her head like a bird beginning to
sing, pressed her handkerchief to her eyes, uttered a wail of mingled
protest and lament, and, giving no heed to the passers-by or to the
remonstrances of her daughter, gave her tears free vent.
They were the unashamed, refreshing tears of her childhood, which
she still retained despite all the storms and shipwrecks of her life.
PART TEN
CHAPTER I
Often, in an hour of depression, Thomas Buddenbrook asked himself
what he was, or what there was about him to make him think even a
little better of himself than he did of his honest, limited, provincial
fellow-burghers. The imaginative grasp, the brave idealism of his
youth was gone. To work at his play, to play at his work, to bend an
ambition that was half-earnest, half-whimsical, toward the
accomplishment of aims that even to himself possessed but a
symbolic value—for such blithe scepticism and such an enlightened
spirit of compromise, a great deal of vitality is necessary, as well as a
sense of humour. And Thomas Buddenbrook felt inexpressibly weary
and disgusted.
What there was in life for him to reach, he had reached. He was well
aware that the high-water mark of his life—if that were a possible
way to speak of such a commonplace, humdrum sort of existence—
had long since passed.
As for money matters, his estate was much reduced and the
business, in general, on the decline. Counting his mother’s
inheritance and his share of the Meng Street property, he was still
worth more than six hundred thousand marks. But the working
capital of the firm had lain fallow for years, under the pennywise
policies of which the Senator had complained at the time of the
affair of the Pöppenrade harvest. Since the blow he had then
received, they had grown worse instead of better; until now, at a
time when prospects were brighter than ever—when everybody was
flushed with victory, the city had at last joined the Customs Union,
and small retail firms all over the country were growing within a few
years into large wholesale ones—the firm of Johann Buddenbrook
rested on its oars and reaped no advantage from the favourable
time. If the head of the firm were asked after his business, he would
answer, with a deprecating wave of the hand, “Oh, it’s not much
good, these days.” As a lively rival, a close friend of the
Hagenströms, once put it, Thomas Buddenbrook’s function on
’Change was now largely decorative! The jest had for its point a jeer
at the Senator’s carefully preserved and faultless exterior—and it
was received as a masterpiece of wit by his fellow-citizens.
Thus the Senator’s services to the old firm were no longer what they
had been in the time of his strength and enthusiasm; while his
labours for the good of the community had at the same time
reached a point where they were circumscribed by limitations from
without. When he was elected to the Senate, in fact, he had reached
those limitations. There were thereafter only places to keep, offices
to hold, but nothing further that he could achieve: nothing but the
present, the narrow reality; never any grandiose plans to be carried
out in the future. He had, indeed, known how to make his position
and his power mean more than others had made them mean in his
place: even his enemies did not deny that he was “the
Burgomaster’s right hand.” But Burgomaster himself Thomas
Buddenbrook could never become. He was a merchant, not a
professional man; he had not taken the classical course at the
gymnasium, he was not a lawyer. He had always done a great deal
of historical and literary reading in his spare time, and he was
conscious of being superior to his circle in mind and understanding,
in inward as well as outward culture; so he did not waste much time
in lamenting the lack of external qualifications which made it
impossible for him to succeed to the first place in his little
community. “How foolish we were,” he said to Stephan Kistenmaker
—but he really only meant himself by “we”—“that we went into the
office so young, and did not finish our schooling instead.” And
Stephan Kistenmaker answered: “You’re right there. But how do you
mean?”
The Senator now chiefly worked alone at the great mahogany
writing-desk in his private office. No one could see him there when
he leaned his head on his hand and brooded, with his eyes closed.
But he preferred it, also, because the hair-splitting pedantries of
Herr Marcus had become unendurable to him. The way the man for
ever straightened his writing-materials and stroked his beard would
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy