31309
31309
https://textbookfull.com/product/practical-sql-a-beginner-s-
guide-to-storytelling-with-data-1st-edition-anthony-debarros/
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.
REFERENCE.
REFERENCE.
The term "skin," like the term "hide," in its widest sense applies to
the natural covering for the body of any animal, but is generally
used with a narrower meaning in which it applies only to the
covering of the smaller animals. Thus we speak of sheep skins, goat
skins, seal skins, pig skins, deer skins, and porpoise skins. It is in
this sense that it will be used in this volume. The treatment of such
skins to fit them for useful purposes comprises the light leather
trade. Whilst this branch of the leather industry is certainly
utilitarian, the artistic element is a great deal more prominent in it
than in the heavy leather branch. Thus the light leathers are often
dyed and artistically finished, and their final purposes (such as fancy
goods, upholstery, bookbinding, slippers, etc.) have rather more of
the element of luxury than of essential utility. The total weight and
value of the skins prepared, and of the materials used in their
preparation, are naturally considerably smaller than those of the
heavy leather trade. In the latter, moreover, one has to consider the
purpose in view from the very commencement of manufacture and
vary the process accordingly, but in light leather manufacture one
aims rather, in the factory, at a type of leather such as morocco
leather, and only after manufacture is it fitted to such purposes as
may be particularly suited to the actual result. These results depend
very largely upon the "grain pattern" which is natural to the skin of
any one species of animals. Hence in Part II. of this volume it has
been found most convenient to deal with the different classes of
skins in different sections. Just as the hides of ox and heifer were
much the most numerous and important of hides, so also naturally
are sheepskins the most prominent section of the raw material of
the light leather trade. This is the more true because the skin is
valued for its wool as well as for its pelt; indeed, the wool is often
considered of primary importance, and receives first consideration in
fellmongering. Unfortunately for the light leather trade, sheepskins,
though most numerous, do not give the best class of light leather,
the quality being easily surpassed in strength, beauty and durability
by the leather from goat or seal skins.
In the wet work for the preparation of skins for tannage much the
same general principles and methods are embodied as in the case of
hides, but with appropriate modifications. As soft leathers are chiefly
wanted, a mellow liming is quite the usual requirement for all skins.
It is also usual to have a long liming, for some skins (like those of
sheep and seal) have much natural fat which needs the saponifying
influence of lime and lipolytic action of the enzymes of the lime
liquors; whilst other skins (like those of goat and calf) are very close
textured and need the plumping action of the lime and a certain
solution of interfibrillar substance. In consequence of the long
mellow liming, sulphides are not usually necessary, and indeed
sodium sulphide is not usually desirable, on account of its tendency
to make the grain harsh. It is used, however, for unwoolling
sheepskins, in such a manner that the grain is not touched. Similarly
caustic soda is seldom required, and the yield of pelt by weight is
usually a small consideration. Systems of liming show some variety.
The one-pit system is very common, and is less objectionable for a
long mellow liming, but rounds of several pits are also used, and in
some cases even more than one round. This is obviously conducive
to regularity of treatment, and as the work involved in shifting the
goods is much less laborious than in the case of heavy ox hides, it
would seem a preferable alternative. The depilation of sheepskins
involves very special methods of treatment (sweating and painting)
on account of the importance and value of the wool, the quality and
value of which would be impaired by putting the skins through
ordinary lime liquors. The pelts, however, are limed after unwoolling.
In deliming light leathers the process of puering is widely used (see
p. 25). This consists in immersing the skins after depilation in a
warm fermenting infusion of dog-dung. In principle this disgusting
process presents a close analogy with bating, and indeed the two
terms are both used somewhat loosely, but there are nevertheless
several points in which the two processes are radically different. The
dog-dung puer is a process carried out at a higher temperature than
the fowl-dung bate; it is also a much quicker process, and the
infusion employed is generally more concentrated. Whilst the fowl-
dung bate is always slightly alkaline to phenolphthalein the dog-
dung puer is always acid to this indicator, and the course of the
puering may be conveniently followed by testing the pelts with it.
The mechanism of the two processes is also probably somewhat
different. The mechanism of the dog-dung puer has been largely
made clear by the researches of Wood and others, and been found
due partly to a deliming action by the amine salts of weak organic
acids and partly to the action of enzymes from a bacillus of the coli
class, which received the name of B. erodiens, and which effects a
solvent action on the interfibrillar substance. As we have noted (Part
I., Section II., p. 24), the fowl-dung bate involves two fermentations,
in each of which (ærobic and anærobic) several species of bacteria
are probably active. Wood found the bacteria of the bate to be
chiefly cocci, and ascribed part of the difference in mechanism by
the nature of the media, which in the bate includes also the urinary
products. In the dog-dung puer, also, a lipolytic action is probably an
essential part of the total effect. The puer gives a much more
complete deliming and a much softer and more relaxed pelt than the
bate, it is therefore particularly suited to the needs of light leather
manufacture. The puering action has been imitated fairly
successfully by artificial methods. "Erodin" (Wood, Popp and Becker)
involves the use of B. erodiens and a suitable culture medium
including organic deliming salts: "Oropon," "Pancreol" and others
involve the use of ammonium chloride and trypsin, together with
some inert matter.
Light-leather goods are usually drenched after puering. They are
also often split green after the wet work. Sheepskins thus yield
"skivers" (the grain split), whilst the flesh split is often given an oil
tannage (see Part IV., Section III.). The greasy nature of sheep and
seal skins necessitates the processes of "degreasing." In the case of
sealskins this is done largely before liming, but with sheepskins
either after being struck through with tan, or after tannage is
complete. Sheepskins are often preserved in the pelt by pickling with
sulphuric acid and salt, which process forms a temporary leather.
The fibres of the pelt are dried in a separate condition, but the
adsorption is easily reversible and the pelts may be "depickled" by
weak alkalies and afterwards given an ordinary vegetable tannage.
In the vegetable tannage of skins for light leathers, the same
theoretical considerations have force as in the heavy-leather section,
but the former has its own rather special requirements and aims.
Generally speaking, a softer and more flexible leather is required,
but these qualities must not be imparted by stuffing with grease as
in the currying of dressing leather, because a bright and grease-free
result is usually required. Hence it is important that a sweet mellow
tannage be given. The durability of the leather is also a primary
consideration for goods intended for bookbinding, upholstery, etc.,
and the tannage must be arranged to impart this quality and avoid
anything tending to cause the perishing of the fibre. Thus oak bark
is a popular tanning material, and sulphuric acid very definitely
avoided. The tannage must be fast, and take the dyestuffs well, and
for the production of light shades of colour in dyeing must be a light-
coloured tannage. All these qualities are imparted by sumach, which
also fits in excellently with the other general requirements, such as
softness, brightness and durability. Hence sumach is the principal
light-leather tanning material, but the tendency is to employ other
materials—oak bark, myrabs, and chestnut extract—to do much of
the intermediate tanning, so that the expensive and useful sumach
may be used for setting the colour and grain at the commencement,
and for brightening, bleaching and mordanting the leather at the
end of the tanning process. Weight is generally no consideration, but
area is often a definite aim, partly because some goods are sold by
area and partly because the striking out, setting out and similar
operations improve the quality of the leather by giving evenness of
finish. Leather well struck out, moreover, is less liable to go out of
shape. As the grain pattern is so important in the finished leather,
appropriate care must be taken during tannage. If a smooth or a
fine grain finish is wanted, for example, the goods must not be
allowed to get wrinkled, creased, doubled or unduly bent to and fro
during the tanning. For such goods, suspension, careful handling
and even the "bag tannage" may be desirable, whilst for coarser and
larger grains paddles or drums may be more extensively used.
Amongst the finishing processes dyeing holds an important position.
The nature of the process has many points of similarity with that of
tanning. The great specific surface of pelt is probably more
enhanced than otherwise during tannage, at any rate with light
leathers, owing to the isolation of fibres, and consequently leather is
as liable as pelt to exhibit adsorption. The dyestuffs, on the other
hand, are substances very easily adsorbed. Some (like eosin and
methylene blue) are crystalloids, some (like fuchsin and methyl
violet) are semi-colloids, whilst others (like Congo red and night
blue) are undoubted colloids forming sols (usually emulsoid) with
water as dispersion medium. The crystalloids and semi-colloids may
also be obtained in colloidal solution, sometimes being so changed
on the mere addition of salts to the solution. In addition, the pelt
has been mordanted with tannin. If, however, leather has been kept
long in the rough-tanned or "crust" state, this may not be so
effective, owing probably to the secondary changes in tanning (Part
I., Section III., p. 46), but such leathers are usually "retanned" or
prepared for dyeing by sumaching (which process also incidentally
bleaches). The tannin mordant assists materially in the fixation of
the dyes. In the case of basic dyestuffs, lakes also are formed, i.e.
there is a mutual precipitation of oppositely charged colloids (+dye,-
tannin). The dyeing of leather is thus a case of colloid reactions even
more complicated than that of tanning.
Another finishing operation typical of the light leathers is "graining"
or "boarding." In this the skins after dyeing and drying are worked
by a board which is covered by cork, rubber, perforated tin or other
material, and so grips or "bites" the leather. The object of "graining"
is to work up the grain pattern by pushing or pulling a fold on the
skin with the board. The nature of the grain varies with the thickness
and the hardness of the skin, with the amount of pressure applied,
with the nature of the board, with the direction of the boarding and
with the total number of directions boarded. There is thus infinite
scope for variety of finish, and hence arise bold grain, fine grain,
hard grain, straight grain, cross grain, long grain, etc. The operation
requires considerable skill and experience. In the case of skins with
little natural grain (such as sheepskin) embossing and printing
machines impress the desired pattern.
In seasoning, a dressing is applied containing essentially albumins
and emulsified fats, e.g. egg albumin and milk. Colouring matters
are also often added to intensify or modify the shade. After
seasoning the goods are usually "glazed" by a machine which rubs
the seasoned grain with considerable pressure, by a glass or
hardwood tool, and so produces a high gloss, for which the
seasoning is very largely a preparation. Light leathers are very lightly
oiled with linseed or mineral oil.
REFERENCES.
SECTION II.—GOATSKINS
Goatskins are amongst the most valued raw material for the
manufacture of light leather. The leather obtained from them is of
the very finest quality in respect to durability and adaptability to the
principal purposes in view. The texture of the fibres in goatskin is
exceedingly compact and very strong, whilst the grain exhibits
naturally a characteristic pattern which renders it most suitable for a
grained finish. Hence for purposes like upholstery, bookbinding,
slippers, it forms almost an ideal material. The tanning and finishing
of goatskins into "morocco leather" may indeed be taken as a quite
typical example of light leather manufacture.
The skins are obtained from all quarters of the globe where goats
exist, and the excellent quality of the leather produced has created a
demand which is greater than the supply. This is due not only to the
demand for morocco leather, but also to the popularity of the
goatskin chrome upper leathers such as "glacé kid" (see Part III.,
Section IV.). The large American trade in the latter has produced the
saying that wherever there is a goat there is an American waiting for
it to die! The European supply of skins is somewhat limited. They
are obtained from the Balkans and Bavaria, in which case they are
small, fine-grained and plump skins. The Swiss goatskins are larger,
and have also a fine grain; they are well grown and well flayed.
Scandinavian skins have a poor reputation, being very flat. The
African supply is important; Abyssinian skins are exceedingly
compact and tough, and are very suitable for "bold grain" finishes.
The Cape skins are particularly large, strong and thick, but their
quality is often impaired by the cure, the skins being flint-dry, and,
like hides so cured, prone to unsoundness. Large quantities of
goatskins also come from the East. Many of these are imported in a
tanned state (E.I. Goat). These skins are tanned with turwar bark,
which contains a catechol tannin. They are also heavily oiled with
sesame oil, and need degreasing. The tannage is also stripped as far
as practicable, and the skins retanned with sumach before finishing.
They make good morocco leathers for many purposes, but the
primary catechol tannage renders them ineligible for finishing under
the specifications of the Committee of the Society of Arts. The skins
have a Persian or Indian origin. India also supplies a large number of
raw dried goatskins which are small and of variable quality. These,
however, are more extensively used for chrome uppers.
Goatskins are imported in either a salted or a dried condition. The
great aim of soaking is to obtain the skins in a thoroughly soft
condition. Hence the soaking is prolonged, and some mechanical
treatment is desirable in addition to various steepings in water. To be
certain of softness it is desirable to avoid the use of alkalies in the
soak waters, for although they cause hydration of the fibres by
imbibition, they also have a plumping effect which is not wanted at
this stage. Salted goatskins are first immersed in water and left until
the following day. This dissolves the salt. They are then stretched
and given a fresh soak liquor of water only to soften further, clean,
and remove the rest of the salt. This second water lasts only a few
hours, and the goods are then drummed well in running water. This
not only cleans quickly, but has an excellent softening effect. They
are again returned to a soak liquor, then softened mechanically by
working them over a beam. This treatment must be repeated,
drumming again if necessary, until the skins are perfectly relaxed
and thoroughly softened. If the treatment be very prolonged it
becomes advisable to use antiseptics in the soak waters after the
first drumming. Solubilized (or emulsified) cresols of the "Jeyes fluid"
type are the most suitable antiseptics, but too much must not be
used or the sterilization affects the liming, in which bacterial action is
needed. Flint-dry skins are left longer in the first soak, which should
be of water only. They are then given a fresh soak liquor containing
0.2 per cent. of sodium sulphide. Sometimes a 1.0 per cent. solution
of borax is used instead; it softens excellently, is antiseptic, and
avoids the plumping effect, but is rather expensive. The goods are
next drummed well, and resoaked and worked as for salted skins. In
either case the soaking takes about a week.
The liming of goatskins presents some points of contrast with the
methods used for other skins. These differences are due to the
exceedingly tight and compact nature of the skin fibres. This
compactness of texture makes it quite necessary to dissolve the
interfibrillar substance to a greater extent than usual, and also to
plump the fibres and split them into the constituent fibrils. These
effects are essential to obtain a rapid and complete tannage and a
soft leather. Too much bacterial action should be avoided, however,
or the brightness and soundness of the grain may be impaired,
which would be a fatal defect in such a leather. Hence the liming is
long rather than mellow, and sharp limes rather similar to those
required for sole leather are often used. Another result of the tight
texture of goatskin is that depilation is not easily effected. This
feature is rather intensified by the deepness of the hair-root. Hence
it is usual to employ sulphides to assist the depilation. In one
method two rounds of five pits are used. The skins are given about
two days in each pit, so that the liming lasts approximately three
weeks. In the first round, which consists of rather mellow limes,
arsenic sulphide is used to assist depilation. Up to 6 per cent. on the
weight of lime is added during slaking. This is a comparatively large
amount of arsenic sulphide, and the depilation is considerably
hastened; the skins indeed are unhaired after passing through this
round, i.e. after about 10 days' liming. In the next round the object
is plumping, and caustic soda (or carbonate) is added to the lime
liquors in quantities comparable to those suggested for sole leather
(Part I., Section V., pp. 55, 56). In this round the goods stay also for
about 10 days. An alternative to the above process is to hasten the
earlier part of the liming by employing sodium sulphide instead of
realgar. More sulphydrate may be obtained in solution in this way,
and the unhairing may be in about half the time. The sulphide of
soda also commences the plumping action which follows in the next
round, but this alternative has the disadvantage that the skins are
unhaired whilst the pelt is swollen with sulphide, which renders the
grain both harsh and tender and consequently more liable to
damage by the unhairer's knife.
Deliming is by puering and drenching, and is often associated with a
further mechanical working of the goods. The skins are inserted into
a puer liquor at 85° F. and thoroughly pulled down. The caustic
alkalies should be completely neutralized. A slight cut into a thick
part at the butt end should develop no pink colour with
phenolphthalein. The skins should be thoroughly relaxed, and the
swelling so much eliminated that they are quite soft, weak and
"fallen." The resilience and elasticity of the plumped skins should
have quite disappeared, and the impressions of hand or thumb
should be readily retained by the pelt. The grain should appear white
and possess a soft and silky feel. In this condition they are again
worked over the beam to soften further if possible. They are then
rinsed and again worked over the beam. Drenching follows with 10
per cent. of bran on the pelt weight, the operation commencing at
85° to 95° F., and lasting till next morning. The skins are next
scudded thoroughly to remove all dirt, but carefully so as not to
damage the grain.
In tanning, sumach and oak bark are the staple materials. Sumach
gives a much lighter colour, and hence it is used alone for goods that
are to be dyed the lighter shades, but oak bark is a "faster" tannage
and more preferable for dyeing in those cases where blacks and very
dark shades are wanted. For ordinary purposes a blend is usually
employed. A feature of oak bark, also, is that it tends to make a
firmer leather, so that the proportion used must be adjusted with
this fact in mind as well as the question of colour. For firmer
moroccos the skins may pass through a handler round of oak-bark
liquors (10°-20°) in which a certain amount of sumach is added to
the liquors. The sumach is leached and assists both in tanning and
bleaching as the liquor works through the round. The old liquor is
run to a paddle, and the tannage is commenced by paddling the
drenched skins in this liquor. It is advantageous both for the tannage
and for the efficient "spending" of the sumach if this liquor be
slightly warmed. In the early pit liquors the goods are very
frequently handled. There is, however, the usual tendency of the
times to save labour in this direction, and hence it is common to
have several paddles with liquors of gradually increasing strength,
followed by a shorter round of handlers in which the handling is
more infrequent. Instead of paddles latticed drums may be inserted
into pits containing liquors. These, however, are not quite so
convenient. In some tanneries, especially where sumach only is
employed, the tannage is in paddles throughout. A new liquor is
made up with fresh sumach and is used repeatedly until exhausted.
A three-paddle system sometimes obtains, in which case the
operation closely resembles the three-pit system of liming (Part I.,
Section II., p. 19), and the skins pass through an "old" liquor, a
"medium" liquor and a "fresh" liquor. The goods need not be paddled
the whole day through, and indeed in the later stages this is
undesirable. The packs remain several days in each liquor and take
up to 14 days to tan. Two to three bags of sumach are needed for
about 20 dozen goatskins. This method of tanning is efficient and
convenient for bold-grain finishes, on account of the constant
tumbling and bending of the skins which tends to work up a grain.
For very soft leathers and fine-grain finishes, however, the "bag-
tannage" or "bottle tannage" is favoured. In this method the pelt is
stitched up by machine to form a bag, grain outwards, leaving a
"neck" in the hind shank. The bag is nearly filled with a fairly strong
infusion of sumach, inflated with air and tied up at the neck. The
bags are then placed into a vat of warm sumach liquor, in which they
just float. The bags are pushed down and the liquor stirred up, so
that the goods are in constant motion. After a few hours they are
piled on a rack, and the tan liquor of the interior is caused to diffuse
through the skins by the pressure due to the weight of the pile. The
bags are refilled with fresh and stronger sumach liquor and the
process is repeated. The skins are thus lightly but effectively tanned
in about 24 hours, and the leather has very fine grain and soft feel.
However tanned the skins are dried out after tanning, and sorted in
the "crust" according to size and colour. The larger skins are
preferred for upholstery and the smaller for fancy goods and
bookbinding.
To illustrate the course of finishing operations, the case of hard-grain
morocco for bookbinding may be given as typical. The goods are wet
back with warm water and drummed for 1-2 hours in warm sumac
to prepare for dyeing. They are then struck out by machine,
sammed and shaved. Dyeing follows, with acid colours, in a drum.
The goods are run first in a little water and the dyestuff added very
gradually through a hollow axle. The acid required (preferably
formic) is added later to develop the full shade. Warm solutions are
used, and the dye bath is practically exhausted. The goods are next
placed in cold water to wash off superfluous liquor and free the skins
from acid. They are then horsed to drain, struck out and hung up to
samm. They are seasoned with milk and water and piled to temper.
They are "tooth rolled" in the glazing machine two ways: right-hand
shank to left fore shank and vice versâ, and piled again. After
wetting back again they are "wet grained" by hand with a cork board
in four directions: belly to belly, shank to shank, and across as
before, and finally from neck to butt. They are immediately hung up
in a warm shed to dry, and to fix the grain. They are then softened
by "breaking down" with a rubber board, top seasoned, piled to
temper and dry, brushed lightly, piled again, brushed more heavily,
and dried out. They are finally softened by graining in three
directions: shank to shank and across, and neck to butt. They are
then brushed again. If these skins are wanted for upholstery they
are shaved after dyeing, and nailed on boards to samm. They are
also dried out in a cooler shed or "stove," to ensure softness.
REFERENCE.
Bennett, "Manufacture of Leather," pp. 39, 55, 89, 111, 204, 344,
396.
SECTION III.—SEALSKINS
REFERENCE.
Bennett, "Manufacture of Leather," 40, 56, 90, 112, 206, 251, 312,
346, 383.
SECTION IV.—SHEEPSKINS
The most numerous class of skins for light leathers is from the
common sheep. These skins have particular value inasmuch as they
include the wool as well as the pelt. This wool, which is actually the
most valuable part of the sheep's skin, is the raw material of our
woollen industries, and is one of the most important of animal
proteids. We have, therefore, in this section to consider this dual
value of sheepskins, the proteid of the epidermis (wool), and the
proteid of the dermis (pelt); one the raw material of the woollen
industry, the other the principal raw material of the light leather
trade. The first problem is to separate the two proteids. With other
skins and hides the ordinary liming processes were sufficient and
appropriate, but in the case of sheepskins the method is unsuitable,
because the exposure of the wool to the action of caustic lime and
possibly other alkalies would seriously impair its quality and reduce
its commercial value. Hence this separation of wool from pelt is
usually quite a separate business, viz. that of the "fellmonger,"
whose occupation it is to collect the sheepskins from butchers and
farmers, to separate the two important constituent proteids, and to
hand the wool in one direction to the "wool stapler," who sorts it
according to quality, and to hand the pelt in another direction to the
light leather tanner, who tans and finishes the pelt to fit it for light
upper work, fancy goods, etc.
In the first instance, therefore, we have to consider the work of the
fellmonger, the separation of wool and pelt. In this work the wool
receives first consideration, and the raw material of the fellmonger is
usually classified accordingly into "long wools," "short wools," and
"mountain breeds." The skins vary very largely in quality of wool and
in quality of pelt, being influenced very strongly by the conditions
under which the sheep lived, and by the precise breed of animal
from which the skin has been taken. As in the case of hides (Part I.,
Section I., p. 8), animals exposed to extremes of weather develop
the best pelts, whereas those sheep which have been carefully bred
and reared for the sake of their wool yield a thin and poor class of
pelt. In Britain, and more especially in England, are reared the finest
and most valuable sheep. This is evident from the prices paid for
them by foreigners and colonial breeders when seeking new blood
for their flocks and fresh stock for their lands. As much as 1000
guineas have been paid by an Argentine firm for a single Lincoln
ram.
Long wools are obtained from some of the best and most extensively
bred animals. The "Cotswolds" are the largest, and probably the
original breed of England are still found on the Cotswold Hills. They
have long wool, white fleeces, white faces, and white legs, and have
no horns. The wool is fine, but the pelts are particularly greasy,
especially along the back. A later breed originating in the Midlands
was called the "Leicester" long wool. This breed gives a great cut of
wool and much coarse mutton. It is very extensively distributed in
the North of England and has been much crossed, so that many sub-
breeds are now well known, e.g. the "Border Leicester"—the general
utility sheep of Scotland—and the "Yorkshire Leicester" or
"Mashams," much bred in Wensleydale. "Lincolns" are another long
wool found only on the Lincolnshire Wolds. They also have white
faces and shanks and yield a large pelt with fine grain. They give a
big crop of wool. "Devons" are a smaller breed common in
Somerset, Devon and Cornwall. They yield a fairly long wool of great
strength, but not quite white. Romney Marsh sheep ("Kents") are
also long wools. They have white legs, white faces, a tuft of wool on
the head, and no horns. The pelt is large and good. "Roscommons"
are an Irish cross-breed with much Leicester blood. They yield a
long wool and a spready pelt.
Short wools are typified by the "Down" sheep. These sheep are
extensively bred on the chalk lands which comprise a very large
percentage of the southern counties of England. The "South Downs"
are the best and most important, the breed being the general utility
sheep of England. They are small but well-shaped animals with grey
faces, no horns and fine close wool. The pelt is only fair, but the
mutton is excellent and provides the meat sold in our best shops.
This breed has largely stocked New Zealand. The "South Down" is a
somewhat delicate animal, and has therefore been largely crossed
with Cotswolds and other breeds. Many well-known cross-breeds are
found in the eastern and southern counties. The "Suffolks," for
example, are found in the eastern counties. They have black heads,
faces and legs. "Oxfords" and "Hampshires" are similar, but larger.
"Shropshires" are another hardy cross-breed, which yield a heavier
fleece. All the cross-breeds are larger than the South Down and yield
bigger pelts.
Mountain breeds yield wool of varying quality but give the best pelts.
The "Cheviots"—much favoured by the Scotch farmers—have a wool
of medium length but with much hair in it. They have white faces
and legs and no horns, and yield excellent pelts. The "Black-faced
Mountain Sheep" have longer wool but coarse, and yield good pelts.
They are kept in the hilly parts of North England and in the Scottish
Highlands. "Lonks" yield a large and good pelt, but very coarse wool.
The mutton is good. They are a very large breed with much curved
horns and black faces. There are also some small breeds, "soft
wools," "Shetlands," and "Welsh Mountain Sheep." The wool of the
last two is poor, but the Welsh pelts are valued for their fine grain.
There are large numbers of sheepskins also imported, from South
and Central America, and from Australia, New Zealand and the Cape.
The colonies, however, have often done their own fellmongering,
and we have imported pickled pelts. They now tan the skins also,
and many tanned sheepskins are now imported. There are also
many Indian skins imported after tannage with turwash bark (cp.
E.I. Goat, Section II., p. 100).
The depilation is brought about by "sweating" (or "staling") and by
"painting." The immediate object of both these types of method is to
avoid using any thing which will affect the wool. The sweating
process is the most ancient method of unhairing and is used in
America for hides as well as sheepskins. It consists of a more or less
regulated putrefaction. The loosening of hair or wool has long been
accepted as evidence that putrefaction had commenced in a hide or
skin, and it is the aim of the sweating process to stop the action at
that stage, before any damage has been done to the pelt. This aim
is achieved rather imperfectly by suspending the goods in closed
chambers and regulating the temperature and humidity by means of
steam and water. Such chambers are known as "sweat pits" or
"tainting stoves". In the case of sheepskins the "warm-sweat"
system is generally used, and the operation is carried out at 75°-80°
F. A satisfactory yield of wool is obtained in good condition, but the
pelt is very liable to suffer bacterial damage and show "weak grain."
The skins are first cleaned by a few "soaks" in clean fresh water,
with intermediate help from a "burring machine" which presents a
rapidly revolving set of spiral blades to the wool, and in the presence
of a good stream of water quickly removes all dirt from the wool.
The skins then enter the tainting stove, and the operation is
commenced by a slight injection of live steam. In summer, about a
week is sufficient to loosen the hair, but in winter up to two weeks
may be necessary. Little control of the process is possible, and all
that can be done is to watch the goods carefully near the end of the
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