Practical SQL A Beginner s Guide to Storytelling with Data 1st Edition Anthony Debarros instant download
Practical SQL A Beginner s Guide to Storytelling with Data 1st Edition Anthony Debarros instant download
https://textbookfull.com/product/practical-sql-a-beginner-s-
guide-to-storytelling-with-data-1st-edition-anthony-debarros-2/
https://textbookfull.com/product/practical-sql-a-beginner-s-
guide-to-storytelling-with-data-1st-edition-anthony-debarros-2/
https://textbookfull.com/product/practical-sql-1st-edition-
anthony-debarros/
https://textbookfull.com/product/sql-quickstart-guide-the-
simplified-beginner-s-guide-to-managing-analyzing-and-
manipulating-data-with-sql-1st-edition-shields/
https://textbookfull.com/product/a-beginner-s-guide-to-working-
with-astronomical-data-1st-edition-markus-possel/
Practical guide to Oracle SQL, T-SQL and MySQL 1st
Edition Preston Zhang
https://textbookfull.com/product/practical-guide-to-oracle-sql-t-
sql-and-mysql-1st-edition-preston-zhang/
https://textbookfull.com/product/beginner-s-guide-to-create-
models-with-3ds-max-ravi-conor/
https://textbookfull.com/product/practical-hive-a-guide-to-
hadoop-s-data-warehouse-system-1st-edition-scott-shaw/
https://textbookfull.com/product/a-beginner-s-guide-to-circuits-
nine-simple-projects-with-lights-sounds-and-more-dahl/
https://textbookfull.com/product/a-beginner-s-further-guide-to-
mathematical-logic-1st-edition-raymond-m-smullyan/
PRACTICAL SQL
A Beginner’s Guide to Storytelling with Data
by Anthony DeBarros
San Francisco
PRACTICAL SQL. Copyright © 2018 by Anthony DeBarros.
All rights reserved. No part of this work may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying, recording, or
by any information storage or retrieval system, without the prior written permission of
the copyright owner and the publisher.
ISBN-10: 1-59327-827-6
ISBN-13: 978-1-59327-827-4
No Starch Press and the No Starch Press logo are registered trademarks of No Starch
Press, Inc. Other product and company names mentioned herein may be the
trademarks of their respective owners. Rather than use a trademark symbol with every
occurrence of a trademarked name, we are using the names only in an editorial fashion
and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The information in this book is distributed on an “As Is” basis, without warranty.
While every precaution has been taken in the preparation of this work, neither the
author nor No Starch Press, Inc. shall have any liability to any person or entity with
respect to any loss or damage caused or alleged to be caused directly or indirectly by
the information contained in it.
About the Author
Anthony DeBarros is an award-winning journalist who has combined
avid interests in data analysis, coding, and storytelling for much of his
career. He spent more than 25 years with the Gannett company,
including the Poughkeepsie Journal, USA TODAY, and Gannett Digital.
He is currently senior vice president for content and product
development for a publishing and events firm and lives and works in the
Washington, D.C., area.
About the Technical Reviewer
Josh Berkus is a “hacker emeritus” for the PostgreSQL Project, where
he served on the Core Team for 13 years. He was also a database
consultant for 15 years, working with PostgreSQL, MySQL, CitusDB,
Redis, CouchDB, Hadoop, and Microsoft SQL Server. Josh currently
works as a Kubernetes community manager at Red Hat, Inc.
BRIEF CONTENTS
Foreword by Sarah Frostenson
Acknowledgments
Introduction
Chapter 1: Creating Your First Database and Table
Chapter 2: Beginning Data Exploration with SELECT
Chapter 3: Understanding Data Types
Chapter 4: Importing and Exporting Data
Chapter 5: Basic Math and Stats with SQL
Chapter 6: Joining Tables in a Relational Database
Chapter 7: Table Design That Works for You
Chapter 8: Extracting Information by Grouping and Summarizing
Chapter 9: Inspecting and Modifying Data
Chapter 10: Statistical Functions in SQL
Chapter 11: Working with Dates and Times
Chapter 12: Advanced Query Techniques
Chapter 13: Mining Text to Find Meaningful Data
Chapter 14: Analyzing Spatial Data with PostGIS
Chapter 15: Saving Time with Views, Functions, and Triggers
Chapter 16: Using PostgreSQL from the Command Line
Chapter 17: Maintaining Your Database
Chapter 18: Identifying and Telling the Story Behind Your Data
Appendix: Additional PostgreSQL Resources
Index
CONTENTS IN DETAIL
FOREWORD by Sarah Frostenson
ACKNOWLEDGMENTS
INTRODUCTION
What Is SQL?
Why Use SQL?
About This Book
Using the Book’s Code Examples
Using PostgreSQL
Installing PostgreSQL
Working with pgAdmin
Alternatives to pgAdmin
Wrapping Up
1
CREATING YOUR FIRST DATABASE AND TABLE
Creating a Database
Executing SQL in pgAdmin
Connecting to the Analysis Database
Creating a Table
The CREATE TABLE Statement
Making the teachers Table
Inserting Rows into a Table
The INSERT Statement
Viewing the Data
When Code Goes Bad
Formatting SQL for Readability
Wrapping Up
Try It Yourself
2
BEGINNING DATA EXPLORATION WITH SELECT
Basic SELECT Syntax
Querying a Subset of Columns
Using DISTINCT to Find Unique Values
Sorting Data with ORDER BY
Filtering Rows with WHERE
Using LIKE and ILIKE with WHERE
Combining Operators with AND and OR
Putting It All Together
Wrapping Up
Try It Yourself
3
UNDERSTANDING DATA TYPES
Characters
Numbers
Integers
Auto-Incrementing Integers
Decimal Numbers
Choosing Your Number Data Type
Dates and Times
Using the interval Data Type in Calculations
Miscellaneous Types
Transforming Values from One Type to Another with CAST
CAST Shortcut Notation
Wrapping Up
Try It Yourself
4
IMPORTING AND EXPORTING DATA
Working with Delimited Text Files
Quoting Columns that Contain Delimiters
Handling Header Rows
Using COPY to Import Data
Importing Census Data Describing Counties
Creating the us_counties_2010 Table
Census Columns and Data Types
Performing the Census Import with COPY
Importing a Subset of Columns with COPY
Adding a Default Value to a Column During Import
Using COPY to Export Data
Exporting All Data
Exporting Particular Columns
Exporting Query Results
Importing and Exporting Through pgAdmin
Wrapping Up
Try It Yourself
5
BASIC MATH AND STATS WITH SQL
Math Operators
Math and Data Types
Adding, Subtracting, and Multiplying
Division and Modulo
Exponents, Roots, and Factorials
Minding the Order of Operations
Doing Math Across Census Table Columns
Adding and Subtracting Columns
Finding Percentages of the Whole
Tracking Percent Change
Aggregate Functions for Averages and Sums
Finding the Median
Finding the Median with Percentile Functions
Median and Percentiles with Census Data
Finding Other Quantiles with Percentile Functions
Creating a median() Function
Finding the Mode
Wrapping Up
Try It Yourself
6
JOINING TABLES IN A RELATIONAL DATABASE
Linking Tables Using JOIN
Relating Tables with Key Columns
Querying Multiple Tables Using JOIN
JOIN Types
JOIN
LEFT JOIN and RIGHT JOIN
FULL OUTER JOIN
CROSS JOIN
Using NULL to Find Rows with Missing Values
Three Types of Table Relationships
One-to-One Relationship
One-to-Many Relationship
Many-to-Many Relationship
Selecting Specific Columns in a Join
Simplifying JOIN Syntax with Table Aliases
Joining Multiple Tables
Performing Math on Joined Table Columns
Wrapping Up
Try It Yourself
7
TABLE DESIGN THAT WORKS FOR YOU
Naming Tables, Columns, and Other Identifiers
Using Quotes Around Identifiers to Enable Mixed Case
Pitfalls with Quoting Identifiers
Guidelines for Naming Identifiers
Controlling Column Values with Constraints
Primary Keys: Natural vs. Surrogate
Foreign Keys
Automatically Deleting Related Records with CASCADE
The CHECK Constraint
The UNIQUE Constraint
The NOT NULL Constraint
Removing Constraints or Adding Them Later
Speeding Up Queries with Indexes
B-Tree: PostgreSQL’s Default Index
Considerations When Using Indexes
Wrapping Up
Try It Yourself
8
EXTRACTING INFORMATION BY GROUPING AND
SUMMARIZING
Creating the Library Survey Tables
Creating the 2014 Library Data Table
Creating the 2009 Library Data Table
Exploring the Library Data Using Aggregate Functions
Counting Rows and Values Using count()
Finding Maximum and Minimum Values Using max() and
min()
Aggregating Data Using GROUP BY
Wrapping Up
Try It Yourself
9
INSPECTING AND MODIFYING DATA
Importing Data on Meat, Poultry, and Egg Producers
Interviewing the Data Set
Checking for Missing Values
Checking for Inconsistent Data Values
Checking for Malformed Values Using length()
Modifying Tables, Columns, and Data
Modifying Tables with ALTER TABLE
Modifying Values with UPDATE
Creating Backup Tables
Restoring Missing Column Values
Updating Values for Consistency
Repairing ZIP Codes Using Concatenation
Updating Values Across Tables
Deleting Unnecessary Data
Deleting Rows from a Table
Deleting a Column from a Table
Deleting a Table from a Database
Using Transaction Blocks to Save or Revert Changes
Improving Performance When Updating Large Tables
Wrapping Up
Try It Yourself
10
STATISTICAL FUNCTIONS IN SQL
Creating a Census Stats Table
Measuring Correlation with corr(Y, X)
Checking Additional Correlations
Predicting Values with Regression Analysis
Finding the Effect of an Independent Variable with r-squared
Creating Rankings with SQL
Ranking with rank() and dense_rank()
Ranking Within Subgroups with PARTITION BY
Calculating Rates for Meaningful Comparisons
Wrapping Up
Try It Yourself
11
WORKING WITH DATES AND TIMES
Data Types and Functions for Dates and Times
Manipulating Dates and Times
Extracting the Components of a timestamp Value
Creating Datetime Values from timestamp Components
Retrieving the Current Date and Time
Working with Time Zones
Finding Your Time Zone Setting
Setting the Time Zone
Calculations with Dates and Times
Finding Patterns in New York City Taxi Data
Finding Patterns in Amtrak Data
Wrapping Up
Try It Yourself
12
ADVANCED QUERY TECHNIQUES
Using Subqueries
Filtering with Subqueries in a WHERE Clause
Creating Derived Tables with Subqueries
Joining Derived Tables
Generating Columns with Subqueries
Subquery Expressions
Common Table Expressions
Cross Tabulations
Installing the crosstab() Function
Tabulating Survey Results
Tabulating City Temperature Readings
Reclassifying Values with CASE
Using CASE in a Common Table Expression
Wrapping Up
Try It Yourself
13
MINING TEXT TO FIND MEANINGFUL DATA
Formatting Text Using String Functions
Case Formatting
Character Information
Removing Characters
Extracting and Replacing Characters
Matching Text Patterns with Regular Expressions
Regular Expression Notation
Turning Text to Data with Regular Expression Functions
Using Regular Expressions with WHERE
Additional Regular Expression Functions
Full Text Search in PostgreSQL
Text Search Data Types
Creating a Table for Full Text Search
Searching Speech Text
Ranking Query Matches by Relevance
Wrapping Up
Try It Yourself
14
ANALYZING SPATIAL DATA WITH POSTGIS
Installing PostGIS and Creating a Spatial Database
The Building Blocks of Spatial Data
Two-Dimensional Geometries
Well-Known Text Formats
A Note on Coordinate Systems
Spatial Reference System Identifier
PostGIS Data Types
Creating Spatial Objects with PostGIS Functions
Creating a Geometry Type from Well-Known Text
Creating a Geography Type from Well-Known Text
Point Functions
LineString Functions
Polygon Functions
Analyzing Farmers’ Markets Data
Creating and Filling a Geography Column
Adding a GiST Index
Finding Geographies Within a Given Distance
Finding the Distance Between Geographies
Working with Census Shapefiles
Contents of a Shapefile
Loading Shapefiles via the GUI Tool
Exploring the Census 2010 Counties Shapefile
Performing Spatial Joins
Exploring Roads and Waterways Data
Joining the Census Roads and Water Tables
Finding the Location Where Objects Intersect
Wrapping Up
Try It Yourself
15
SAVING TIME WITH VIEWS, FUNCTIONS, AND TRIGGERS
Using Views to Simplify Queries
Creating and Querying Views
Inserting, Updating, and Deleting Data Using a View
Programming Your Own Functions
Creating the percent_change() Function
Using the percent_change() Function
Updating Data with a Function
Using the Python Language in a Function
Automating Database Actions with Triggers
Logging Grade Updates to a Table
Automatically Classifying Temperatures
Wrapping Up
Try It Yourself
16
USING POSTGRESQL FROM THE COMMAND LINE
Setting Up the Command Line for psql
Windows psql Setup
macOS psql Setup
Linux psql Setup
Working with psql
Launching psql and Connecting to a Database
Getting Help
Changing the User and Database Connection
Running SQL Queries on psql
Navigating and Formatting Results
Meta-Commands for Database Information
Importing, Exporting, and Using Files
Additional Command Line Utilities to Expedite Tasks
Adding a Database with createdb
Loading Shapefiles with shp2pgsql
Wrapping Up
Try It Yourself
17
MAINTAINING YOUR DATABASE
Recovering Unused Space with VACUUM
Tracking Table Size
Monitoring the autovacuum Process
Running VACUUM Manually
Reducing Table Size with VACUUM FULL
Changing Server Settings
Locating and Editing postgresql.conf
Reloading Settings with pg_ctl
Backing Up and Restoring Your Database
Using pg_dump to Back Up a Database or Table
Restoring a Database Backup with pg_restore
Additional Backup and Restore Options
Wrapping Up
Try It Yourself
18
IDENTIFYING AND TELLING THE STORY BEHIND YOUR
DATA
Start with a Question
Document Your Process
Gather Your Data
No Data? Build Your Own Database
Assess the Data’s Origins
Interview the Data with Queries
Consult the Data’s Owner
Identify Key Indicators and Trends over Time
Ask Why
Communicate Your Findings
Wrapping Up
Try It Yourself
APPENDIX
ADDITIONAL POSTGRESQL RESOURCES
PostgreSQL Development Environments
PostgreSQL Utilities, Tools, and Extensions
PostgreSQL News
Documentation
INDEX
FOREWORD
Sarah Frostenson
Graphics Editor at POLITICO
ACKNOWLEDGMENTS
Practical SQL is the work of many hands. My thanks, first, go to the team
at No Starch Press. Thanks to Bill Pollock and Tyler Ortman for
capturing the vision and sharpening the initial concept; to
developmental editors Annie Choi and Liz Chadwick for refining each
chapter; to copyeditor Anne Marie Walker for polishing the final drafts
with an eagle eye; and to production editor Janelle Ludowise for laying
out the book and keeping the process well organized.
Josh Berkus, Kubernetes community manager for Red Hat, Inc.,
served as our technical reviewer. To work with Josh was to receive a
master class in SQL and PostgreSQL. Thank you, Josh, for your
patience and high standards.
Thank you to Investigative Reporters and Editors (IRE) and its
members and staff past and present for training journalists to find great
stories in data. IRE is where I got my start with SQL and data
journalism.
During my years at USA TODAY, many colleagues either taught me
SQL or imparted memorable lessons on data analysis. Special thanks to
Paul Overberg for sharing his vast knowledge of demographics and the
U.S. Census, to Lou Schilling for many technical lessons, to
Christopher Schnaars for his SQL expertise, and to Sarah Frostenson
for graciously agreeing to write the book’s foreword.
My deepest appreciation goes to my dear wife, Elizabeth, and our
sons. Thank you for making every day brighter and warmer, for your
love, and for bearing with me as I completed this book.
INTRODUCTION
Shortly after joining the staff of USA TODAY I received a data set I
would analyze almost every week for the next decade. It was the weekly
Best-Selling Books list, which ranked the nation’s top-selling books
based on confidential sales data. The list not only produced an endless
stream of story ideas to pitch, but it also captured the zeitgeist of
America in a singular way.
For example, did you know that cookbooks sell a bit more during the
week of Mother’s Day, or that Oprah Winfrey turned many obscure
writers into number one best-selling authors just by having them on her
show? Week after week, the book list editor and I pored over the sales
figures and book genres, ranking the data in search of the next headline.
Rarely did we come up empty: we chronicled everything from the
rocket-rise of the blockbuster Harry Potter series to the fact that Oh, the
Places You’ll Go! by Dr. Seuss has become a perennial gift for new
graduates.
My technical companion during this time was the database
programming language SQL (for Structured Query Language). Early on, I
convinced USA TODAY’s IT department to grant me access to the
SQL-based database system that powered our book list application.
Using SQL, I was able to unlock the stories hidden in the database,
which contained titles, authors, genres, and various codes that defined
the publishing world. Analyzing data with SQL to discover interesting
stories is exactly what you’ll learn to do using this book.
What Is SQL?
SQL is a widely used programming language that allows you to define
and query databases. Whether you’re a marketing analyst, a journalist,
or a researcher mapping neurons in the brain of a fruit fly, you’ll benefit
from using SQL to manage database objects as well as create, modify,
explore, and summarize data.
Because SQL is a mature language that has been around for decades,
it’s deeply ingrained in many modern systems. A pair of IBM researchers
first outlined the syntax for SQL (then called SEQUEL) in a 1974
paper, building on the theoretical work of the British computer scientist
Edgar F. Codd. In 1979, a precursor to the database company Oracle
(then called Relational Software) became the first to use the language in
a commercial product. Today, it continues to rank as one of the most-
used computer languages in the world, and that’s unlikely to change
soon.
SQL comes in several variants, which are generally tied to specific
database systems. The American National Standards Institute (ANSI)
and International Organization for Standardization (ISO), which set
standards for products and technologies, provide standards for the
language and shepherd revisions to it. The good news is that the
variants don’t stray far from the standard, so once you learn the SQL
conventions for one database, you can transfer that knowledge to other
systems.
Among the eminent citizens of this century, none will take a higher
place than the late J. J. Gurney, Esq., the well-known philanthropist.
He was born at Earlham Hall on August 8th, 1788. That hall was
one of the happiest homes in England. It was also the birth-place of
Mrs. Elizabeth Fry, sister of J. J. Gurney, and almost as celebrated as
her brother. Here they were both trained with religious care, and
passed their days of childhood and youth in happiness and peace.
In after life they were associated together in works of benevolence,
and the brother often aided his sister in many of her schemes for
improving prison discipline.
In 1803, soon after he had completed his 15th year, Joseph John
was sent to Oxford with his cousin Gurney Barclay to pursue his
studies under the care of John Rogers, a private tutor. Young J. J.
Gurney continued at Oxford two years, with the exception of the
vacations, which he spent mostly at home. His tutor, though
resident at Oxford, was not in that character connected with the
university or with any of the colleges. The student became an
excellent classical and oriental scholar, and ultimately the author of
several valuable religious works, such as “Essays on Christianity,”
“Thoughts on Habit and Discipline.” He was scarcely seventeen
when, in August, 1805, he was removed from the care of John
Rogers. He had become attached to his tutor and to his studies, and
he quitted the place with regret, but there was brightness in the
thought of settling at home. The bank in which his father was a
partner had been established in Norwich in the year 1770. After that
time the concern was considerably extended with branch banks at
Lynn, Fakenham, Yarmouth, and other places. His elder brother,
John, had been placed in the establishment at Lynn, and his brother
Samuel had been sent up to London, where he had become the
head of a district concern; so that circumstances had prepared the
way for that which J. J. Gurney himself had desired—a place in the
bank at Norwich. Here in the enjoyment of daily communication
with his father, and a home at Earlham with his sisters, the ensuing
three years of his life passed in peace and joy. In the year 1806, he
accompanied his father and a large family party in a tour to the
English lakes and through Scotland. On their return, J. J. Gurney
was regular in his attendance at the bank, but he found time for
study at home, and he carefully read ancient historians in the
original languages. Gradually, however, his attention became
unceasingly directed to biblical literature, which continued for some
years to absorb much of his leisure. His habits of study were
eminently methodical, exemplifying his favourite maxim, which he
was afterwards accustomed strongly to inculcate upon his young
friends, “Be a whole man to one thing at a time.” His position and
tastes introduced him to the highly-cultivated society, for which
Norwich was at the time remarkable, at the house of his cousin
Hudson Gurney, where he was accustomed to meet many persons
who were eminent for their parts and learning. He had early
become a favourite with Dr. Bathurst, then Bishop of Norwich, and
their intercourse gradually ripened into a warm friendship, which
was maintained unbroken till that prelate’s decease, in 1837, at the
very advanced age of ninety-three. Young J. J. Gurney was but just
twenty-one when, as one of his father’s executors and
representative at Earlham, and as a partner in the bank, very grave
responsibilities devolved upon him. However, he continued to
pursue his studies with ardour, and he made his first essay as an
author in an article published in the Classical Journal on September
9th, 1810, under the title of “A Critical Notice of Sir William
Drummond’s Dissertations on the Herculanesia.” After this effort his
mind became increasingly drawn towards the principles of the
Society of Friends, and many of his allusions to his feelings, in his
autobiography, are peculiarly interesting and instructive, indicating
the spiritual phase of his mind. The example of his sister, Elizabeth
Fry, as well as of his sister Priscilla, who like her, had become a
decided Friend and a preacher of the gospel, strengthened his
convictions; but the influence of other members of the family who
resided at Earlham, as well as of many other estimable persons,
tended in an opposite direction. The editor of the Memoirs, already
referred to, says:—
“To this place (with its lovely lawn nested among large trees) he
was strongly attached all his life. And they who knew him there
can still picture him in his study among his books, or in his
drawing-room among his friends, his countenance beaming with
love and intelligence, the life of the whole circle; or in his
garden amongst his flowers, with his Greek Testament in his
hand, still drawing from the books ‘of nature and of grace’ that
lay open before him, new motives to raise the heart to the
Author of all his blessings.
“Placed by circumstances, though not the elder brother, in the
position which his father had occupied in Norfolk as Master of
Earlham, and a partner in the bank, it was his delight, as far as
possible, to continue Earlham as the family house. Even after
his marriage, his sisters, Catherine, Rachel, and Priscilla,
continued to live with him, occupying their own apartments, and
it was the custom of the other members of the family frequently
to meet there as under a common roof. * * * Up to the period
of his brother John’s decease, and for some time afterwards, it
was the habit of his brothers and himself, with their brothers-in-
law, Thomas Fowell Buxton and Samuel Hoare, to improve these
occasions by a mutual impartial examination of their conduct, in
which each with brotherly openness stated what he conceived
to be the brother’s faults. Happy indeed was such an
intercourse between such minds. * * * Besides this, to him,
delightful band of brothers and sisters, his house was, as must
have been already apparent to the reader, freely opened to a
large circle.
“Whilst every year strengthened his conviction of the soundness
and importance of the christian principles which he professed,
he rejoiced in that liberty wherewith Christ had made him free
to embrace as brethren all those in whom he thought he could
discern traces of his heavenly image.
“Towards the close of the year (1817) in company with his wife,
his brother Samuel Gurney, his brother and sister Buxton, and
Francis and Richenda Cunningham, he took a short tour upon
the continent of Europe, their principal objects being to
establish a branch Bible Society in Paris, and to procure
information as to the systems of prison discipline adopted in the
jails of Antwerp and Ghent. Having accomplished their objects,
they returned home after an absence of about a month.”
“In the 8th and 9th month of this year (1818), in company with
his wife, his sister Elizabeth Fry, and one of her daughters, he
took a journey into Scotland, visiting many of the prisons both
there and in the north of England, besides attending many of
the meetings of Friends. On this occasion, in conformity with
the christian order established in the Society of Friends, he was
furnished with a minute or testimonial expressing the
concurrence of his Friends of his own ‘Monthly Meeting’ in his
prospects of religious service.”
Bishop Bathurst.
Henry Bathurst, LL.D., canon of Christchurch, rector of Cirencester,
and prebend of Durham, was installed bishop of Norwich in 1805.
He was a prelate much esteemed and respected. His christian
deportment, conciliatory manners, and general benevolence,
endeared him to this city and diocese. He was eminently
distinguished for his liberal sentiments, and for his attachment to the
great principles of civil and religious liberty. He was often seen
walking arm in arm with Dissenters in our streets. He voted in the
House of Peers for the Repeal of the Catholic Disabilities Bill, and
also in favour of the Reform Bill. This disinterested and noble
advocacy of liberal principles is thought to have stood in the way of
his promotion to an archbishopric. He died April 7th, 1837, in the
93rd year of his age, and much lamented. A statue to his memory
was placed in the choir of the Cathedral. This beautiful work of art
was the last work of Sir Francis Chantrey, and is executed in his
masterly style from a block of the purest Carrara marble. It is
placed on a plain pedestal of white marble, and fixed in the recess at
the foot of the altar steps, on the north side of the choir, commonly
called Queen Elizabeth’s seat, because she sat there when she
visited Norwich. The bishop is represented in a sitting posture,
clothed in full ecclesiastical costume, and the artist has admirably
succeeded in giving to his face that expression of benevolence for
which he was so well known.
The following is a translation of the Latin inscription on the pedestal:
—
To the Memory of
The Right Reverend Father in Christ,
HENRY BATHURST, Doctor in Civil Law,
Who,
While for more than 30 years he presided over
This Diocese,
By his frankness and purity of heart,
Gentleness of manners, and pleasantness of conversation,
attached to himself the good will of all:
His friends,
In testimony of their regret for one so much beloved,
Have caused this effigy to be erected.
He died 5 Ap. A.D. 1837, in the 93rd year
Of his age.
Bishop Stanley.
Dr. Stanley was born January 1st, 1779, and became rector of
Alderley, in Cheshire. After twice declining the office, he was
installed bishop of Norwich, August 17th, 1837. He ruled the
diocese for twelve years, and was highly esteemed by all sects for
his unceasing efforts to promote the spiritual interests of every class
of society, and his readiness on every occasion to co-operate with
Dissenters in every good work. He often attended their meetings to
promote religious and benevolent objects. In one of his sermons he
quoted the injunction “The servant of the Lord must not strive, but
be gentle unto all men; in meekness instructing those that oppose
themselves;” &c. His subsequent conduct furnished ample evidence
of the sincerity with which he obeyed this injunction; and although
some of his clergy were somewhat estranged from him by his
frequent expressions of unbounded charity, yet all were obliged to
esteem him for his noble zeal and consistency of character. He was
distinguished for his extensive liberality to the poor and his interest
in their education. He was often seen going about from school to
school, and the kindliness of his heart was so well known to the
children that they sometimes pulled his coat behind to obtain his
benignant smile, which to them was like sunshine after rain. On all
occasions he was earnest in his advocacy of civil and religious liberty,
and active in his exertions on behalf of all benevolent associations,
both of the Church and of Dissenters. He was also a promoter of all
literary institutions in the city and elsewhere, and often attended
their anniversaries at which he delivered animated addresses. He
did not lay claim to the character of a man of science; but
astronomy, geology, botany, and natural history were his favourite
studies. He was the author of two interesting volumes on “The
History of Birds,” which were published by the Society for the
Promotion of Christian Knowledge. He was elected president of the
Linnæan Society, and he accepted an appointment as one of the
commissioners chosen to inquire into the state of the British
Museum.
Bishop Stanley was so little of a bigot that he appeared once on the
same platform with Father Mathew, a Roman Catholic, at a
temperance meeting in St. Andrew’s Hall. He then and there
eulogised the apostle of temperance, and advocated the cause with
great eloquence. On another occasion he invited Jenny Lind, now
Madame Goldscmidt, to the palace, when she visited this city. At the
palace one evening, she sang before a large company. When it
became known that the lord bishop of the diocese had actually
entertained an operatic singer, great was the indignation of some of
the clergy. This however did not at all distress the good bishop, who
held on the even tenor of his way, doing good whenever he had an
opportunity. By his frequent earnest discourses in many churches in
this diocese, he caused quite a revival of religion among the clergy
and church-going people. He died, much lamented, on September
6th, 1849, in the 70th year of his age, and he was buried in the
middle of the nave of the Cathedral, in the presence of thousands
who had known and loved him. A short time after his decease, a
slab to his memory was laid over his grave, bearing the following
inscription:—
In the love of Christ
Here rests from his labours
EDWARD STANLEY,
Thirty-two years Rector of Alderley,
Twelve years Bishop of Norwich,
Buried amidst the mourning
Of the Diocese which he had animated,
The City which he had served,
The Poor whom he had visited,
The Schools which he had fostered,
The Family which he had loved,
Of all Christian people
With whom, howsoever divided, he had joined
In whatsoever things were true and honest,
And just, and pure, and lovely,
And of good report.
Born January 1st, 1779.
Installed August 17th, 1837.
Died September 6th, 1849, Aged 70.
Buried September 21st, 1849.
Bishop Hinds.
“John Greene Crosse was the second son of Mr. William Crosse,
of Finborough, in Suffolk, and was born on the 6th of
September, 1790. In order to make known some particulars of
his early life and education, I cannot do better than quote his
own journal, which contains many remarks upon the subject
evidently intended to have formed part of a history of his life.
In April, 1819, he penned the following observations.
“‘I never went to boarding school, which contributed, with many
other occurrences of my subsequent life, to fix me in the
unsocial habits that hitherto never did and never will forsake
me. In my early years, no classical learning, not a line of Latin,
was taught at the proximate market town to which I resorted as
a daily pupil; and my first lessons of reading, arithmetic, and
writing were received from a master of whom I entertained the
greatest horror, for the ferocity of his conduct, the severe
discipline by which he drove into us the simplest rudimental
knowledge. His stern brow, raucous voice, and long cane, are
now livelily depicted to my mind: how much I owe to him, I am
even now, with a long life in retrospect, unable to tell; but I was
glad when circumstances arose that released me from his
tutorage.’
“‘Very small matters, and such as we have no control over, and
call accidental because unable to trace the chain of causes
giving rise to them, influence our mortal destinies. I had
attained my 12th (?) year, under such tremendous instruction as
is related, when a Welsh gentleman making some mistake at
college (not implicating his good character, an informality I
should call it) found it well to rusticate; and taking with him his
premature wife, sought a living by opening a classical school in
Stowmarket. I became one of his early pupils; and but for this
good, easy man’s settling in the town, should never have
launched into such studies as Latin and Greek; of which, it is
true, I did not learn much, nor very accurately. But he was,
nevertheless, a plodding, working man; an increasing family
made him exert his abilities to the utmost; and I got out of him
all the instruction I ever received as a school-boy in the learned
languages. When about fifteen years of age, returning from my
daily school, in a feat in jumping, I had the accident, I ought
not perhaps to say the misfortune, to break my leg. The
respectable village surgeon attended me: he was one of the old
school; of fine, soft, soothing manners, clean dressed, with
powdered head; rode slowly a very well-looking horse; in short,
he was a gentleman, and commanded the respect of every one
when he entered the house; he was also a skilful and kind
surgeon. What wonder that the idea should be awakened in my
mind to be of the medical profession! to be as great a man as
he—the Village Doctor! to whom every one bowed, and who
could relieve pain and cure injuries so quickly and skilfully. I
had conceived an object of ambition, and the idea never
deserted me. I was in a month upon my crutches, and soon
recovered; a surgical case fixed my future destinies.’
“‘I persevered a few years longer at Latin, Greek, French, and
Euclid. My father was successful and able now to place me out
well; wished me to be a lawyer, and I was for a time under the
instruction of a gentleman of that profession—attending
bankruptcy meetings, and feasting at midnight at the expense
of the already distracted creditors. Those were good times for
lawyers. A learned chancellor, whom I met on one such
occasion, I well remember complimenting me on my quickness
in counting money; but all would not do, my mind was
prepossessed—I quitted the law to follow my inclination; I made
my own choice; it was a pledge to success. The surgeon who
cured my leg agreed to take me as his first and only pupil, and I
was accordingly articled in due form for five years.’
“On the 27th of September, 1811, Mr. Crosse went to London for
the purpose of studying his profession in that Metropolis, and
was the following day introduced to Mr., afterwards Sir Charles
Bell, whose pupil he became, with whom he contracted a close
intimacy, and of whose merits as a teacher and man of science
he always spoke in the highest terms of respect and gratitude.
In the following January, he entered to Abernethy’s Lectures;
and in April, 1812, became a student at St. George’s Hospital,
where his industrious habits and intelligence attracted the
particular attention and marked notice of the medical officers of
that noble institution. In the following month, he entered as a
pupil at the Lock Hospital; and in the course of the year,
officiated as House Surgeon during the temporary absence of
the gentleman who occupied that situation. In the following
winter session, commencing October, 1812, he studied under
Brodie, Bell, Brande, Clarke, Home, and others; and remarks in
his journal, ‘very industrious all this winter, sitting up constantly
till past two a.m.’ In March, 1813, he became a dresser to Sir
Everard Home at St. George’s Hospital; attended Midwifery
under Dr. Clarke; and on the 16th of April, passed the College of
Surgeons in London. After a short holiday, he returned to
London on the 13th of May, and attended the Eye Infirmary at
Charter-house Square. In June, he resigned his dressership
under Sir E. Home; became acquainted with the late Mr.
Travers, Abernethy, Sir W. Blizard, and Dr. Macartney, whom he
agreed to accompany to Dublin; and much of his spare time
during this summer was devoted to the study of German, a
language he ever after cultivated that he might enjoy the
profundity and research of the professional literature of that
country.
“Mr. Crosse left England for Dublin on the 2nd of October, 1813,
arriving there the following day. In December he became
Demonstrator of Anatomy under Dr. Macartney, and remained
there until October, 1814, when he returned to London, having
received a very handsome testimonial from the numerous
students of the school in which he taught, as to his ability and
energy in the capacity of their instructor in anatomy.
“On quitting Dublin, Mr. Crosse returned to Suffolk, and was
afterwards introduced to the late Dr. Rigby of Norwich. In
December he went to Paris, where he remained until the end of
February, 1815, during which period he took French Lessons,
wrote his Diary in the French language, and availed himself of
every possible opportunity of increasing his professional
knowledge.
“On the 29th of March, 1815, Mr. Crosse came to Norwich; and
after remaining one year in lodgings, took a house in St. Giles’,
in which he resided for many years. He soon after published his
“Sketches of the Medical Schools of Paris,” and showed, both by
his writings and the industrious pursuit of his professional
avocation, that he was destined to arrive at considerable
eminence in the locality he had chosen for the arena of his
future life. On the 19th of July, 1823, he was the successful
candidate for the appointment of Assistant Surgeon to the
Norfolk and Norwich Hospital. So great was his desire to
become connected with the Hospital, and so strong the
competition in which he was engaged to obtain this object, that
his health gave way under the exertions he made to succeed;
and he was obliged to absent himself for a time, on which
occasion he took a trip to Holland, visiting Brighton on his
return. The result was favourable, and he returned to Norwich
in good health. On the death of Mr. Bond, in 1826, he was
elected full Surgeon to the Hospital, and thus attained one of
the greatest objects of his ambition.
“The rapid rise and progress of Mr. Crosse’s reputation as a
professional man, and the large extent of his private practice,
are too well known to require further notice; but
notwithstanding the unremitting exertions required to fulfil his
private engagements, he never allowed them to interfere with
his public duties; and the devotedness of his service to the
Norfolk and Norwich Hospital was remarkable. It may be truly
said that no private patient received more kindness, skill, and
attention at his hands, than did those who were placed under
his care in the wards of the Hospital.
“As an operating surgeon, Mr. Crosse had but few superiors, and
not many equals. He was possessed of considerable manual
tact and dexterity, which, coupled with a sound judgment as to
the necessity for the performance of an operation, stamped him
as a surgeon of first-rate attainments. In his early professional
life he studied anatomy with great assiduity, and his subsequent
occupation as Demonstrator of Anatomy at Dublin so impressed
the subject upon his memory, that the constitution and form of
the human body were always in his mind’s eye; and thus he was
rendered equal, at all times and upon all occasions, to the
serious emergencies of surgery. In short, he obtained and held
for a long period the foremost rank in his profession in this
district; and such was the quality of his mind, that he would
probably have been pre-eminent in whatever locality it might
have fallen to his lot to be placed.
“In 1819, Mr. Crosse published A History of the Variolous
Epidemic of Norwich, which has been, and is even now, quoted
as an excellent standard work. In 1822 he published Memoirs
of the Life of the late Dr. Rigby, prefixed to the valuable Essay
which the Doctor had published some years before On Uterine
Hæmorrhage.
“In 1835, the Jacksonian Prize was awarded him for his Essay
on the Formation, Constituents, and Extraction of the Urinary
Calculus; and in the same year he received, in consequence of
this Essay, the Diploma of M.D. from the University of
Heidelberg.
“From 1822 to the close of his life, Mr. Crosse contributed many
valuable Papers to different medical periodicals, which are of
deep interest to professional men.
“In 1836, Mr. Crosse was elected a Fellow of the Royal Society—
a distinction which marked him for eminence throughout the
whole civilized world. In 1845, the College of St. Andrew
conferred the Degree of M.D. upon him, and there is scarcely a
medical or surgical society in Europe of which he was not a
member, as well as being an honorary member of the most
eminent societies in Asia and America.
“During the last year of Mr. Crosse’s life (1850), it became
painfully evident to his friends that he was gradually losing that
vigour of mind and body which had so long characterized him;
and at the urgent solicitation of his medical advisers, he was
induced to leave home for a few weeks, when he took the
opportunity of consulting Sir B. Brodie and Dr. Watson in
London, and spent a short time with the late Dr. Mackness at
Hastings, of whose kindness he afterwards spoke in the highest
terms of gratitude. On his return home, he endeavoured to
resume his professional and even his literary avocations; but
although in a degree benefited by his holiday, he gradually lost
power, and it was clear that his race was almost run.”
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.
textbookfull.com