Practical SQL A Beginner s Guide to Storytelling with Data 1st Edition Anthony Debarros 2024 scribd download
Practical SQL A Beginner s Guide to Storytelling with Data 1st Edition Anthony Debarros 2024 scribd download
com
https://textbookfull.com/product/practical-sql-a-beginner-s-
guide-to-storytelling-with-data-1st-edition-anthony-
debarros/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/practical-sql-a-beginner-s-guide-to-
storytelling-with-data-1st-edition-anthony-debarros-2/
textboxfull.com
https://textbookfull.com/product/practical-sql-1st-edition-anthony-
debarros/
textboxfull.com
https://textbookfull.com/product/a-beginner-s-guide-to-working-with-
astronomical-data-1st-edition-markus-possel/
textboxfull.com
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/
textboxfull.com
https://textbookfull.com/product/beginner-s-guide-to-create-models-
with-3ds-max-ravi-conor/
textboxfull.com
https://textbookfull.com/product/practical-hive-a-guide-to-hadoop-s-
data-warehouse-system-1st-edition-scott-shaw/
textboxfull.com
https://textbookfull.com/product/a-beginner-s-guide-to-circuits-nine-
simple-projects-with-lights-sounds-and-more-dahl/
textboxfull.com
https://textbookfull.com/product/a-beginner-s-further-guide-to-
mathematical-logic-1st-edition-raymond-m-smullyan/
textboxfull.com
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.
Point XXXIX.
I n this point mention is made, That of the Fruit of Trees and other
Bushes and Shrubs, a clear Drink may be made, which is also
grateful and durable, being like to Wine in taste, colour, and virtue;
which thing, although it may seem strange to those who are
ignorant of the matter, nevertheless it is most true; so that those
things which are contained in this point, may be boldly credited. For
what should it profit me to write those things which I am not able to
prove, it would only turn to my disgrace and detriment. For this
reason I have determined to have such a Laboratory prepared, in
which not only the owners of Metallick Mines (if they desire it of me)
may learn the manner by me newly invented, for the compendious
melting of Minerals, so that they shall yield more Metal, than by the
known and common manner; but will also shew other Secrets, that
the Magnalia and wonders of God may be made manifest, and We
stirred up to give Thanks to the Giver of all Good: Which Elaboratory
shall continue open for one whole year, which being past, it shall
again be shut up and cease; for I purpose not to render the whole
course of my Life obnoxious to those great Labours, but at length to
enjoy a quiet tranquility; which thing I am willing that all men should
know, that they may spare me with their Letters, which it is
impossible for me to answer, much less that I should see the
Persons, seeing that the burden of journying is to me altogether
insupportable; but whatsoever I may perform at home, I will not
refuse. [See for this point Apology against Farnner.]
Here thou hast, benevolent Reader, a fundamental Explication of
my Miraculum Mundi, (as for those last points, to wit, 36, 37, 38,
and 39, they might indeed have been very commodiously explained
here, but because this is done at large, in a peculiar Treatise,
entituled, The Prosperity of Germany; there is no need to explain
them in this place; therefore what the benevolent Reader finds
wanting here, there he shall find it at large, to which I remit him)
whereby it will appear to all men, unless to those who are wilfully
blind, that I have not ascribed too much to the Salt of the Earth, as
a universal subject, but that I have proved to the whole World, that
every thing which I have attributed to it, is possible, and plainly
agreeable to Truth. But that these Secrets which I have proved, may
be performed by the benefit of the Salt of the Earth, may not be
done by other waies, and perhaps nearer, I go not about to deny,
but do necessarily affirm, that the mentioned Metallicks, as well as
the Mechanicks, may be performed after other manners. Only here it
is verified, That the Salt of the Earth is deservedly esteemed a
universal subject, which no man will deny, nor will be able to refute
by Arguments, supported by truth, how wise soever he may seem to
himself. Therefore let its vileness offend no man, for the best of
things is oftentimes hidden in things of small price. Wherefore all
men erre, who attribute good to outward splendor, in which yet it is
not, but is only to be sought, found, and obtained in things vile, and
of low esteem. Note this, believe this, otherwise thou wilt never
attain to any Good.
But here some Man may object in this manner: If Nitre be a
Universal Menstruum according to my praises of it, it will thence
necessarily follow, that the stone of Philosophers should be made by
it, of which nevertheless I have here made no mention. To obviate
this Objection, I do indeed readily confess, that I have not
proceeded in this subject, any further than those things which I have
now proved; but without doubt it containeth in it self greater things,
than are manifested to me and others. I have made a beginning, I
have strowed the way, let others follow me, and prosecute the thing
further, if God shall grant it to them; as for me I am content with
small things, and do not anxiously, or sollicitously aspire after the
highest. Yet in the mean time, this I freely confess, if I were not so
old as I am, I should not leave this Matter unessay’d. It is not to be
doubted, but many men have sought the Universal stone in Nitre,
but what they have found, that themselves know; and of this I am
the more assured, because there Matter in the end of the Work
taking fire, hath vanished like a Clap of Thunder; hence the ancient
Philosophers have performed their work in Winter, lest they should
be hurt by Corruscations; it is most true, and void of all errour, that
a most noble essence of this sort, obtaining a power of expelling all
the Natural Diseases of Mortals, and of transmuting all the imperfect
Metals into Gold cannot be prepared from an impure Metal, or
Mineral, nor also of Gold it self. Much less of viler and more unlikely
things in which Fools are miserably Occupied, prodigally, and
unprofitably wasting their Goods; but in my judgment, it should be
no other thing than a Concentrated Astral fire, exalted by Art, into
the form of a stone, without any other Adventitious matter. For in
the nature of things, no purer Essence can be found, than fire,
exercising a very great power in all things, especially in Metals: For if
we had not fire (I pray consider it) all Arts, and Mechanicks would
grow cold, and be involved in the dark silence of Cessation. Arts
were invented, and draw their Original from the fire, otherwise how
should Metals be got out of their Minerals, and prepared for use?
truly they would be of no use at all. Therefore the fire containeth
more than can be believed. He that doth not know fire to be a most
powerful Element, knoweth nothing, nor without this, can he find
out any thing, neither by any just right can he assume the Name of
a Philosopher. The fire alone, without the addition of other things, is
sufficient to make Metals of stones, and particularly, the best Metals
out of the vilest stones, provided we know how to use it; but
universally, being concentrated into a stony matter; which last
although I have not experienced, nevertheless I have observed, if
(by the favour of the Almighty) a man could exalt the fire into a
Corporeal fixed substance, he would certainly have a Tincture for
men, and the imperfect Metals. But some man may object, by what
way is this Crown to be obtained? Truly by no other than by Divine
Revelation. For the Secrets of God of this sort, are not so easily to
be found out, nor will they be manifested to Impious men, although
the whole World is infected with a foolish madness, who doatingly
think by force to extort Gold from things in which it is not, and one
that hath understanding of the fire and Metals, cannot sufficiently
admire those foolish and doltish Labours, which they who are
Captivated by the hunger of Gold, undertake for the making the
stone of Philosophers; many being willing to ascend the Ladder, are
presently sollicitous about the uppermost Round, when
notwithstanding they are as yet far from the lowermost step: But
this is a matter of a higher and more diligent search. In the fire, I
say, are contained Secrets of great moment, yea, insomuch that
some Philosophers (among whom Plato is the chief) write that God
is most clearly discerned and apprehended in Fire and Salt. Fire, and
the Immortal God alone can make light of darkness, which is
granted to no Mortal to do; without fire is darkness and death:
Without fire nothing can live, nothing groweth or encreaseth.
In sum, Fire is the most Noble, and most Potent Work of God in
the whole Universe, he that knoweth how to use it rightly, will have
need of no Art. Let the Benevolent Reader also take with him my
small judgment concerning the great stone of the wise; let every
man believe what he will, and is able to comprehend. Such a work is
purely the gift of God, and cannot be learned by the most acute
powers of an humane mind, if it be not assisted by the benign help
of a Divine Inspiration. And of this I assure my self, that in those last
times, God will raise up some, to whom he will open the Cabinet of
Natures Secrets, that they shall be able to do wonderful things in the
World, to his glory, the which I indeed heartily wish to Posterity, that
they may enjoy, and use to the Praise and Honour of God, Amen.
The E P I L O G U E.
I doubt not but many Men considering the great good that may be
effected by the benefit of Nitre, will be desirous of knowing how
they may attain it in great quantity, that so they may not be forced
to buy it at a dear rate; which certainly would be a great help not to
a few who labour in the fire, and I could wish from my Soul, that all
honest and pious Chymists might be able to recover some
compensation for the Coals they have consumed without fruit. But
seeing that I have made mention of the production or preparation of
Nitre, in a peculiar Treatise entituled, The Prosperity of Germany; it
is needless here to repeat it. But this I will say by way of prediction,
that Nitre, being thoroughly known by my Writings, true Alchymy, or
the Transmutation of the imperfect Metals into better, will in a short
time be as common, as it was in Egypt long since in the time of the
Emperour Dioclesian, who could not overcome or subdue the
Egyptians, until he had by many Cruelties extorted their Books from
them, which he burnt, and so brought them under the yoke of
servitude. NB. That it is no wonder that the Transmutation of Metals
should have been so common with the Egyptians only, seeing that
Nitre is found in all places of the Land of Egypt, and the famous
River Nile is impregnated with Nitre, which only by its overflowing
(which it doth twice in a year) so fateneth the whole Country, that it
is made very rich and fruitful in all things without dung; for the Nile
aboundeth with Nitre, as the Sea doth with common Salt. For at
certain times of the overflowing, viz. in the beginning, the
inhabitants are wont to dig deep Pits, that they may remain full of
the water, which being afterwards dried up by the Sun, Nitre is very
Copiously prepared, as common Salt is made in Spain, and other hot
Regions. This therefore I was willing to discover for the information
of the Reader; if he be wise, and God be propitious to him, he will
believe that I have said enough; but if not, an Explication ten times
clearer will not help him. Therefore let it suffice, that what is here
desired, shall be had in those Treatises which are entituled, The
Prosperity of Germany, whereby a man filled with the Love of God,
will be greatly delighted.
THE
C O N T I N UA T I ON
OF
Miraculum Mundi.
In which Nature is clearly laid open to the Eyes of the whole
World; demonstrating, that the chief Medicine of Vegetables,
Animals, and Minerals, may be prepared of Salt-petre, and that
Salt-petre truly merits the Name of an Universal Menstruum.
The P R E F A C E, to the R E A D E R.
T
his Treatise, to which I have given the Title of the Continuation
of Miraculum Mundi, containeth four excellent Arcanums,
which I doubt not, but will prove very profitable to the
publick. The first of these I offer to Country-men, as Husbandmen,
Vine-dressers, Gardiners, and all such who are occupied in Tilling
and manuring the Earth, that they may learn a new Method of
fattening and enriching their Fields and Gardens, without the usual
and customary way of dunging, and thence yearly acquire a greater
profit.
The Second, I give to all Citizens, Merchants and others who have
time and leasure, and abounding in riches, know not by what means
to augment or improve their Gold and Silver. Which way I will shew
them, and how to effect it after a much better and honester manner
than putting it to Usury, or incommoding or oppressing their
Neighbours.
The Third, I present to all Conscientious Physicians that they may
learn to prepare Salutiferous and Efficacious Medicines with small
charge, little labour, and in a short time; that (as becomes
Christians) they may help and succour the Miseries of the sick, and
acquire to themselves an honest livelihood.
The Fourth, I dedicate to all persons of great Name and Authority,
by the benefit of which, they may preserve their Health entire, and
recover it when lost.
The Omnipotent God give us his Divine Grace, that we may make
such use of his fatherly bounty, as may tend to the promoting of his
Honour, and the Love of our Neighbour. Amen.
Arcanum I.
Being a Gift given to Husbandmen, keepers of Vineyards, Gardeners,
&c.
F irst, Let a round Furnace be built with Bricks of the same form
with that in the first Figure, noted with the Letter A. It must be
like a Glassmaker’s Furnace, large at the bottom, and rising round by
degrees to a small point at the top; in the top must be a round hole,
opening about a foot broad, by which the Wood may be put into the
Furnace. To the hole is to be fitted a Cover or Stopper, made of the
same matter, with the Bricks, and burnt as they are, to shut up the
hole. On one side of the lower part of the Furnace, is to be a door,
by which the Coals may be taken out. On the other side is to be a
little hole, to which an earthen Channel or Pipe of about three or
four cubits long, is to be fitted, in which the smoak or fume of the
wood, forced out by the fire, may be condensed into an acid juice,
and may destil into a wooden Vessel or Barrel, which is to be fitted
to the Pipe, to receive the destilling acid juice. See the first Figure
noted with pag. 13. at the beginning of this Treatise.
A is the Furnace or Oven wherein the Wood is char’d.
B, The Cover of the Furnace.
C, The Door at which the Coals are taken out.
D, The Canes or Pipes wherein the sap or juice of the Wood is
condensed, and from thence runs into the Receiver.
E is the Vessel or Receiver into which the Vinegar of Wood runs.
All things being prepared in the manner aforesaid, let the Furnace
be filled with wood up to the top, and if the wood be not dry
enough, intermix with it, in the putting in from the bottom to the
top, some dry Shrubs or Bushes, or small Faggot-sticks, by whose
help the wood may be the more easily kindled. After the wood is
kindled, and burns well, the hole in the top of the Furnace is to be
close shut with its Stopper, that there may be no exit for the smoak,
but that it may be forced to descend and seek its passage through
the lower hole, by the Channel or Pipe. Therefore when the wood
begins to burn, and yet can emit no flame, the heat presseth out all
the juice, and forceth it into the pipe, in which, from the smoak, it is
changed into an acid Juice or Liquor, which destilleth by the Pipe into
the appointed receiving Barrel. All the wood being turned into Coals,
and emitting no more fume, the whole Furnace, wheresoever it may
admit the air; and also the hole to which the Pipe is fitted, is to be
smeared over with wet ashes, that the Coals in the Furnace being
suffocated or choaked, may remain entire. The Coals being taken
out, may be put to necessary uses, being equal in goodness to other
Charcoal which Colliers make in Woods. NB. I would have this
understood, of such wood as is of a pretty good thickness, and
suffers its self to be reduced into Coals; for if you cast into the
Furnace Bushes or small Brushy wood, to press out the juice, you
will obtain only a Powder of Coals, which after the juice is pressed
out, is to be left in the Furnace open (not smeared over, as we
taught above) till it pass into ashes, which is required for the
coagulating the expressed juice; as shall appear by and by, when we
come to speak of its coagulation. NB. When you have no occasion
for Coals, or cannot sell them, it is necessary, that letting the
Furnace be open, you suffer them to burn to ashes. If this operation
be instituted in a place where there are stones fit to make Lime of, it
would be worth the while to fill the Furnace with a layer of Wood,
and another of Stones, from the bottom to the top, which Chymists
call Stratum super Stratum, and after the juice is pressed out to
open the Furnace, that the wood may be turned into ashes, by doing
of which at the same time the stones will be calcined, and changed
into Lime, which being exposed to the air, (yet so that the Rain
cannot come to it) will fall to pieces into a fine powder. To this
Powder, being mixed with wood ashes, the acid juice is to be poured,
which was pressed out of the wood, that those two contrary natures
may mutually work upon each other, and well unite: in which
operation the sharp spirit of the wood loseth its Acrimony, and the
fixed Salt of the wood and stones is altered, so that from both there
proceedeth a contrary middle nature, and a sweeter salt; which
being long exposed to the air, draweth from thence a Life, and is
transmuted into the best Salt-Petre. NB. This mixture is so to be
exposed to the air, that lying under a Covering or Roof, and being
open on the sides, it may be defended from the Rain, and
nevertheless attract the air. If it shall be dried by the air, it must be
moistened again with the Urine of Men or Beasts, that it may never
be throughly dry. If these things be rightly performed, you shall have
plenty of the best Salt-petre, from this matter, in the space of a year
and an half, or two years at the most; which being extracted,
purified, and boiled up, shooteth into very pure Crystals. The rest of
the matter being again laid in its former place, under the covering or
shed, and being ordered in the same manner, as before, will in the
space of two years produce new Salt-Petre, which may be extracted
and boiled up as before; for that mixture still remaineth good,
provided it be moistened with Urine when dry, as was said. NB. He
that desireth to acquire Salt-petre sooner, after the conjunction of
the acid spirit with the ashes, and the precipitation and mortification
of both, from that conjoined matter, by the pouring on of water, he
may extract and boil up the Salt, and then dissolve the Salt in Urine,
and digest it by Circulatory Vessels; by which means he may obtain
the best Salt-petre in the space of one year. This labour of pressing
the juice out of Wood, and at the same time of making Stones into
Lime, may be used in all those Cities and Places where wood and
stones are plenty. But if this operation were to be instituted in a
Wood, there would be no need of a Furnace built with stone, seeing
that the Pile of Wood might be covered all over with green Turfs,
after the same manner which Colliers use in making their Charcoal,
only with this difference, that here must be a hole in the side, to
which the duct or pipe is to be adjoined. The juice being pressed
out, the pile or stack is to be every where well closed, that the Air
may have no passage, if you would preserve the Coals. All being
cooled, the Coals may be taken out and sold, or put to necessary
uses, so that the expressed juice, which being received in no Vessel,
would have vanished in smoke, plainly costs nothing; but if you do
not desire Coals, let them be burnt into ashes, that they may serve
for the coagulating the spirit into salt, and afterwards by the help of
the air, in a certain space of time transmute it into good Salt-Petre.
A. Ist der Ofen darin das holtz gebresset wirdt.
B. Der deckel darmit der Ofen geschlossen wirdt.
C. Die thur an dem Ofen dardurch man die kohlen aus
nimbt.
D. Seind die röhren darinnen sich der holtzsafft
Condensirt vnd heraus rinnt.
E. Ist ein fas darin der holt essig laufft.
A. Ist der Ofen.
B. Das distillier gefäs in dem Ofen.
C. Das loch mit einem faltz dardurch das swänge
eingetragen wird.
D. Die Zange mit deckel darmit das gefäs nach dem
eintragen geschlossë wirdt.
E. Ein Eisen löffel darmit der schwan eingetragen wirdt.
F. Die recipienten.
G. Die banck darauf die recipienten ligen.
H. der Laborant.
A. Ist der Ofen wie er in der arbeit stehet.
B. Ist der Vnterste theil des Ofens wie er offen ohne die
vorder wand anzusehen.
C. Ist das obertheil des Ofens.
D. Der rost in dem Ofen.
E. der Herd.
F. der Müffel so auff den herd gehöret.
G. der Deckel dar mit der Ofen oben gedecket wird wann
kohlen darin sein vnd in voller arbeitstehet.
H. das rauch fanglein an dem Ofen.
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