(Ebooks PDF) Download Getting Started With SQL A Hands On Approach For Beginners 1st Edition Thomas Nield Full Chapters
(Ebooks PDF) Download Getting Started With SQL A Hands On Approach For Beginners 1st Edition Thomas Nield Full Chapters
com
https://textbookfull.com/product/getting-started-
with-sql-a-hands-on-approach-for-beginners-1st-
edition-thomas-nield/
https://textbookfull.com/product/getting-started-with-phantomjs-
beltran-aries/
textbookfull.com
https://textbookfull.com/product/ercp-the-fundamentals-3rd-edition-
peter-b-cotton/
textbookfull.com
https://textbookfull.com/product/coincidance-a-head-test-1st-edition-
robert-anton-wilson/
textbookfull.com
https://textbookfull.com/product/discover-your-authentic-self-be-you-
be-free-be-happy-first-edition-sherrie-dillard/
textbookfull.com
Teaching philosophy a guide 1st Edition Steven M. Cahn
https://textbookfull.com/product/teaching-philosophy-a-guide-1st-
edition-steven-m-cahn/
textbookfull.com
Getting Started with
SQL
A HANDS-ON APPROACH
FOR BEGINNERS
Thomas Nield
Getting Started with SQL
A Hands-on Approach for Beginners
Thomas Nield
Boston
Getting Started with SQL
by Thomas Nield
Copyright © 2016 Thomas Nield. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or [email protected].
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Getting Started with SQL, the cover
image, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-491-93861-4
[LSI]
Table of Contents
Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
2. Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
What Is a Database? 3
Exploring Relational Databases 3
Why Separate Tables? 4
Choosing a Database Solution 5
Lightweight Databases 5
Centralized Databases 6
3. SQLite. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
What Is SQLite? 9
SQLiteStudio 9
Importing and Navigating Databases 10
4. SELECT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Retrieving Data with SQL 19
Expressions in SELECT Statements 23
Text Concatenation 27
Summary 28
iii
5. WHERE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Filtering Records 29
Using WHERE on Numbers 30
AND, OR, and IN Statements 31
Using WHERE on Text 32
Using WHERE on Booleans 34
Handling NULL 34
Grouping Conditions 36
Summary 37
7. CASE Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
The CASE Statement 47
Grouping CASE Statements 48
The “Zero/Null” CASE Trick 49
Summary 52
8. JOIN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Stitching Tables Together 53
INNER JOIN 55
LEFT JOIN 58
Other JOIN Types 61
Joining Multiple Tables 61
Grouping JOINs 63
Summary 66
9. Database Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Planning a Database 67
The SurgeTech Conference 69
ATTENDEE 69
COMPANY 69
PRESENTATION 70
ROOM 70
PRESENTATION_ATTENDANCE 70
Primary and Foreign Keys 70
iv | Table of Contents
The Schema 71
Creating a New Database 73
CREATE TABLE 76
Setting the Foreign Keys 84
Creating Views 86
Summary 89
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Table of Contents | v
Foreword
Over the past three decades, computers have taken over the world. Twenty-five years
ago, we lived analog. We communicated using an analog POTS telephone, we tuned
in to analog FM radio stations, and we went to the library and browsed the stacks for
information. Buildings were constructed using hand-drawn blueprints; graphic artists
worked with pen, brush, and ink; musicians plucked strings and blew into horns and
recorded on analog tape; and airplanes were controlled by physical cables connecting
the yoke to the control surfaces.
But now everything is computerized and digital. Consequently, every member of
society needs to be familiar with computers. That does not mean having the deep
knowledge of a techie, but just as poets need to study a little math and physics, and
just as mathematicians need to read a little poetry, so too does everybody today need
to know something about computers.
I think that this book really helps to address the knowledge gap between techies and
laypeople, by providing an accessible and easy-to-read discussion of SQL—a core
database technology.
vii
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Preface
Nobody needs to learn how a car engine works in order to drive a car. The whole
point of technologies like SQL is to allow you to focus on the business problem, and
not worry about how the technical details are executed. This book will give you a
practical focus on using SQL, and will steer away from unnecessary technical details
that are likely not pertinent to your immediate needs. Much of the content revolves
around hands-on exercises with real databases you can download so you see how
concepts are applied. When you finish this book you will have practical knowledge to
work with databases, as well as use them to overcome your business challenges.
ix
When working with technology, you are never expected to know everything. As a
matter of fact, technology topics are so vast in number it would be impossible. So it is
helpful to develop a degree of tunnel vision and learn only enough to fulfill the task at
hand. Otherwise, you can get overwhelmed or distracted learning irrelevant topics.
Hopefully this book will give you a foundation of knowledge, and afterward you can
continue to learn about topics that are pertinent to you.
You are always welcome to reach out to me at [email protected], and I will answer
any questions to the best of my ability. If you have questions about positioning your
career with technical skillsets or have a SQL question, I might be able to help. I hope
that this material not only augments your skillset and career opportunities, but also
sparks new interests that excite you like it did for me.
x | Preface
the code. For example, writing a program that uses several chunks of code from this
book does not require permission. Selling or distributing a CD-ROM of examples
from O’Reilly books does require permission. Answering a question by citing this
book and quoting example code does not require permission. Incorporating a signifi‐
cant amount of example code from this book into your product’s documentation does
require permission.
We appreciate, but do not require, attribution. An attribution usually includes the
title, author, publisher, and ISBN. For example: “Getting Started with SQL by Thomas
Nield (O’Reilly). Copyright 2016 Thomas Nield, 978-1-4919-3861-4.”
If you feel your use of code examples falls outside fair use or the permission given
above, feel free to contact us at [email protected].
Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research,
problem solving, learning, and certification training.
Safari Books Online offers a range of plans and pricing for enterprise, government,
education, and individuals.
Members have access to thousands of books, training videos, and prepublication
manuscripts in one fully searchable database from publishers like O’Reilly Media,
Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que,
Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kauf‐
mann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders,
McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more
information about Safari Books Online, please visit us online.
Preface | xi
How to Contact Us
Please address comments and questions concerning this book to the publisher:
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://bit.ly/getting-started-with-sql.
To comment or ask technical questions about this book, send email to bookques‐
[email protected].
For more information about our books, courses, conferences, and news, see our web‐
site at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Acknowledgments
I am blessed to have amazing people surrounding me, and I realize how central they
have been in my life and everything I do. If it was not for them, this book would
probably not have happened.
First and foremost, I would like to thank my mom and dad. They have given every‐
thing to secure my future. I know for a fact that I would not have the opportunities I
have today if it was not for them. My dad worked hard to provide a better education
for my brothers and me, and my mother always pushed me forward, even when I
resisted. She taught me to never settle and always struggle through my limits.
I cannot express enough gratitude toward my leaders, managers, and colleagues at
Southwest Airlines Revenue Management. Justin Jones and Timothy Keeney have a
warrior spirit and zeal for innovation that few possess. They truly define the leader‐
ship and spirit of Southwest Airlines, but more importantly they are good guys. They
will always be my friends and they’ve made it hard to imagine a life without South‐
west Airlines.
xii | Preface
Robert Haun, Brice Taylor, and Allison Russell continuously work to make our team
the forefront of innovation and continuously pursue new ideas, and I am blessed to
work in the environment they have helped create. I also have to thank Matt Louis for
bringing me on board at Revenue Management, and Steven Barsalou who made me
realize how little I really knew about SQL. Steven is the first person who came to
mind when I needed a reviewer for this book, and I am grateful he came on board
this project.
Then there is the project team I work with every day: Brian Denholm, Paul Zigler,
Bridget Green, Todd Randolph, and Chris Solomon. As a team, the feats we pull off
never cease to amaze me. Brian is the kind of project manager that can effectively
bridge technology and business jargon together, and he will not hesitate to get his
hands dirty with SQL and the occasional code review. I want to give a special thanks
to Chris Solomon for helping me with everything I do every day. He not only has a
rare talent to absorb high volumes of technical knowledge and maintain it in a busi‐
ness perspective, but he is also a nice guy that I am privileged to be friends with.
Chris is always a key player in any project, and I was thrilled when he agreed to
review this book.
I cannot forget the great people who worked at Southwest Airlines Ground Ops
Safety Regulatory Compliance, including Marc Stank, Reuben Miller, Mary Noel
Hennes, and everybody else I had the privilege of working with. I interned and con‐
tracted with that department a few years back and some of my fondest memories are
there. It was there I discovered my passion for technology, and they provided many
opportunities for me to pursue that, whether it was throwing together databases or
prototyping an iPad app.
When I announced I was publishing this book I did not expect Richard Hipp, the
founder and creator of SQLite, to reach out to me. Richard graciously stepped up to
be the technical reviewer for this book and it has been a tremendous honor to have
him on board. The technology community continues to amaze me, and the fact
Richard Hipp joined this project shows how unique and close-knit the community
really is.
Shannon Cutt has been my editor at O’Reilly for this book. This is my first book and I
was uncertain what the publishing experience would be like. But Shannon made pub‐
lishing such a pleasant experience that I am eager to write again. Thanks Shannon,
you have been awesome!
Last but not least, I want to thank Watermark Church and the volunteers at Careers
in Motion for creating the vehicle that made this book happen. I initially wrote this
“book” as a public service to help unemployed professionals in the Dallas area. It was
at their encouragement that I decided to publish it, and I want to give a special thanks
to Martha Garza for her insistence. I have learned remarkable things can happen
when you give your time to help others.
Preface | xiii
CHAPTER 1
Why Learn SQL?
1
Who Is SQL For?
One misperception about SQL is that it is an IT skill and therefore only applicable to
technology (not business) professionals. In the world as it exists today, this is hardly
the truth. Businesspeople, managers, IT professionals, and engineers can all reap ben‐
efits from learning SQL to better position their careers. SQL can open many career
paths because it enables individuals to know their businesses better through the data
that is driving them. On the business side, interest in SQL can lead to roles that are
analytical, managerial, strategic, and research- or project-based. On the IT front, it
can lead to roles in database design, database administration, systems engineering, IT
project management, and even software development.
What Is a Database?
In the broadest definition, a database is anything that collects and organizes data. A
spreadsheet holding customer bookings is a database, and so is a plain-text file con‐
taining flight schedule data. Plain-text data itself can be stored in a variety of formats,
including XML and CSV.
Professionally, however, when one refers to a “database” they likely are referring to a
relational database management system (RDBMS). This term may sound technical
and intimidating, but an RDBMS is simply a type of database that holds one or more
tables that may have relationships to each other.
3
We can reasonably expect there to be another table, maybe called CUSTOMER
(Figure 2-2), which holds the customer information for each CUSTOMER_ID.
When we go through the ORDER table, we can use the CUSTOMER_ID to look up the cus‐
tomer information in the CUSTOMER table. This is the fundamental idea behind a “rela‐
tional database,” where tables may have fields that point to information in other
tables. This concept may sound familiar if you’ve used VLOOKUP in Excel to retrieve
information in one sheet from another sheet in a workbook.
Notice that for the Re-Barre Construction orders someone had to populate the cus‐
tomer information three times for all three orders (the name, region, street address,
city, state, and zip). This is very redundant, takes up unnecessary storage space, and is
difficult to maintain. Imagine if a customer had an address change and you had to
update all the orders to reflect that. This is why it is better to separate CUSTOMERS and
ORDERS into two separate tables. If you need to change a customer’s address, you only
need to change one record in the CUSTOMER table (Figure 2-4).
4 | Chapter 2: Databases
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Figure 2-4. A normalized table
We will explore table relationships again in Chapter 8, and learn how to use the JOIN
operator to merge tables in a query so the customer information can be viewed along‐
side the order.
Lightweight Databases
If you are seeking a simple solution for one user or a small number of users (e.g., your
coworkers), a lightweight database is a good place to start. Lightweight databases have
little to no overhead, meaning they have no servers and are very nimble. Databases
are typically stored in a file you can share with others, although it starts to break
down when multiple people make edits to the file simultaneously. When you run into
this problem, you may want to consider migrating to a centralized database.
The two most common lightweight databases are SQLite and Microsoft Access.
SQLite is what we will use in this book. It is free, lightweight, and intuitive to use. It is
used in most of the devices we touch and can be found in smartphones, satellites, air‐
craft, and car systems. It has virtually no size limitation and is ideal for environments
where it is not used by more than one person (or at most a few people). Among many
other uses, SQLite is ideal to learn SQL due to its ease of installation and simplicity.
Microsoft Access has been around for a while and is inferior to SQLite in terms of
scalability and performance. But it is heavily used in business environments and
Centralized Databases
If you expect tens, hundreds, or thousands of users and applications to use a database
simultaneously, lightweight databases are not going to cut it. You need a centralized
database that runs on a server and handles a high volume of traffic efficiently. There
is a wide array of centralized database solutions to choose from, including the follow‐
ing:
• MySQL
• Microsoft SQL Server
• Oracle
• PostgreSQL
• Teradata
• IBM DB2
• MariaDB
You can install some of these solutions on any computer and turn that computer into
a server. You can then connect users’ computers (also known as clients) to the server
so they can access the data. The client can send a SQL statement requesting specific
data, and the server processes the request and returns the answer. This is a classic
client–server setup. The client requests something, and the server gives it.
While you can turn any MacBook or cheap PC into a MySQL server, larger traffic vol‐
umes require more specialized computers (called server computers) optimized for
server tasks. These are typically maintained by an IT department whose members
administrate and control databases formally deemed critical to the business.
As you enter a workplace, chances are an existing centralized database might exist
with information you need, and you will need to request access to it. While we will
not be covering centralized databases in this book, the experience between different
database solutions should largely be the same. Across all database solutions, you use
6 | Chapter 2: Databases
SQL to interact with tables in a pretty uniform way, and even the SQL editor tools are
somewhat similar. Each solution may have nuances to its implementation of SQL,
such as date functionalities, but everything in this book should be universally applica‐
ble.
If you ever do need to create a centralized database solution, I would highly recom‐
mend MySQL. It is open source, free to use, and straightforward to install and set up.
It is used by Facebook, Google, eBay, Twitter, and hundreds of other Silicon Valley
companies.
With a conceptual understanding of databases, we can now start working with them.
Although we will use SQLite in this book, keep in mind it uses SQL, so the knowledge
you gain is applicable to all database platforms.
What Is SQLite?
As discussed in the previous chapter, there are many places to put data. But often‐
times we want a quick, easy place to put data without all the hassle of a client–server
setup. We want to store data in a simple file and edit it just as easily as a Word docu‐
ment. This is an optimal situation to use SQLite.
SQLite is the most widely distributed database in the world. It is put on iPhones,
iPads, Android devices, Windows phones, thermostats, car consoles, satellites, and
many other modern devices that need to store and retrieve data easily. It is used heav‐
ily in the Windows 10 operating system as well as the Airbus A350 XWB aircraft. It
excels where simplicity and low overhead is needed. It is also great for prototyping
business databases.
But every technology has a trade-off. Because it has no server managing access to it, it
fails in multiuser environments where multiple people can simultaneously edit the
SQLite file. Still, for our training purposes, SQLite is perfect.
SQLiteStudio
There are many SQL editors you can use to work with a SQLite database. I strongly
recommend using SQLiteStudio, as it is intuitive and makes it easy to explore and
manage a database. We are going to use that application in this book. You can down‐
load it at http://sqlitestudio.pl/?act=download. Be sure to choose Windows, Mac, or
Linux for your respective OS. Then open the downloaded folder and copy it to a loca‐
tion of your choice. No installation is needed. To start SQLiteStudio, double-click
SQLiteStudio.exe (Figure 3-1). You can also create a shortcut on your desktop so you
can easily launch the application in the future.
9
Random documents with unrelated
content Scribd suggests to you:
“Because,” she spoke passionately, “you may love it—would love it;
and I cannot spare one thought, one word, one look of yours!”
I sighed, I could not help it. Then I reminded her of a great oak we
had seen during an expedition with Dr. Hildyard into the adjacent
county. We had paused to look at the giant, around whose spreading
branches ivy had climbed and twisted until bough after bough was
dying.
She had said:
“That ivy clings to the tree like I cling to you.”
“The ivy is choking the life out of the oak,” said I; “it is to be hoped
you will not do the same by me.”
I said it, and she took it, jestingly. But, as I told her, if matters do
not mend—if I cannot at least have freedom for study, or to go to
town now and then on business and to look people up, my end may
be the same as the oak’s.
She was all penitence, all promises; nor would she leave the study
until I had given her my word that I would for the future go on my
own way regardless of her feelings, which she would try to modify by
degrees.
Before we retired for the night, I had promised to go to town to-
day for some scientific works I particularly want, and to transact
neglected business.
Sunday, May —.
The little one is a week old to-day. It is very sweet to see mother
and son together. I could sit and look at them by the hour. But “Life
is real, life is earnest!” as the great author of that incomparable
“Psalm of Life” says; and all the more that the boy has come upon the
scene, I must be “up and doing, with a heart for any fate!”
Any fate! what fate can I fear, with those two precious ones to love
and work for?
July —.
“P. S.—The number of our box is 9. I will leave word at the door that you are
coming.”
Hugh wavered; but before he knew that he had consented to the
fair letter-writer’s proposition, the count had left him, and he could
hardly withdraw his half-reluctant consent.
“I suppose I must go,” he told himself.
He disliked the proceeding altogether. The sense that he was doing
that which he reprehended in others, acting for the great of this
world in a manner he would certainly not act for the lowly, oppressed
him throughout the day.
“It is a step in the wrong direction,” he told himself, as he stood
before the glass, arranging that conventional white tie which he
professed to disdain, with “the rest of men’s enforced toggery,” as he
called the swallowtails and chimneypots, “but I have let myself in for
it somehow, and must go through with it.”
He would not have out his carriage; he took a hansom to the opera
house. On entering, he stood amazed! There had been a drawing-
room that day, and the ladies who were alighting from their carriages
and sailing and sweeping through the entrance-hall and up the
staircase were in all the bravery of silk, satin, and velvet, and literally
ablaze with jewels. The heated air was scented with the perfumes
they used, and with the odour of the Court bouquets they carried.
The scene of excessive luxury was foreign to the severe simplicity of
Dr. Paull’s hard-working life.
“I suppose all this is good for trade,” he thought, as he made his
way through the glittering throng to box 9, “but it seems a queer way
for mortals to spend their time.”
He was ushered into the box just as the final bars of the National
Anthem were being played, for it was a semi-State performance in
honour of a foreign potentate. Lady Forwood, a fair young dame with
a bright face, was standing in front of the box. She turned to welcome
him.
“It is very good, indeed, of you to come,” she said, as she warmly
shook hands. “Don’t say, No! David and I flatter ourselves we
understand you pretty well. I know that nothing but a sense of duty
brings you here. However, now that you are here, you may as well
have a good look at it all. Take that chair. David is at the House. He
may look in, but not till late; there is some important debate on to-
night. Now, tell me, it is a fine sight, isn’t it?”
“It certainly is,” said Hugh.
The orchestra had struck up the spirited introduction to the new
opera, and the unaccustomed sounds of bright music insensibly
raised his spirits. The coup-d’œil of the gigantic horseshoe of tiers of
crimson-curtained boxes filled with ladies in brilliant attire, white
and the palest tints predominating, was magnificent.
“I never imagined women could look so like flowers,” said he,
honestly.
“I thought you would think better of us when you knew a little
more about us!” laughed Lady Forwood, who was scanning the house
through her lorgnettes. “There! Mercedes has just come in! How
lovely she looks! What a magnificent dress! I suppose she was at the
drawing-room. I went last time, so I was not there to-day.”
“Where?” said Hugh, drawing back a little, and feeling like a
conspirator.
“Not in the chandelier! and not exactly in the pit,” said Lady
Forwood, laughingly. “Don’t be shocked at me! I positively can’t help
teasing people. Look at the third from the royal box. There, she is
just settling herself, and throwing off her mantilla—the lady in
white.”
Hugh was looking at the third box to the left of the royalties.
“Take my glass,” said Lady Forwood, “and look at the third box to
the right of the royal people. Make haste, for in another minute she
may settle herself behind the curtain and stay there the whole
evening. It would be just like her.”
Hugh focussed the glass, and with a singular sensation that was
almost a thrill, he gazed at a lovely girl who was leaning forward
glancing round the house. She was pale with a waxen pallor; her
black hair was dressed high, and studded with pearls. She wore a
white velvet gown, a shade whiter than her beautifully moulded bust
and arms, and this appeared to be sewn with pearls. So youthful was
her slender form that, had Hugh not recognized the Prince
Andriocchi and his friend the count hovering in the background, he
would hardly have believed this could be the new patient about
whom so much fuss had been made.
“She is quite a girl!” he said, in surprise, turning to Lady Forwood.
“Why not?” asked she. “She was only married a year ago. Spanish
girls marry young.”
“But, from what you said, I fancied you had been girl friends,” said
Hugh, without thinking.
“How like you, to say that!” said Lady Forwood, with a good-
natured laugh, as Hugh, forgetting his dislike to the rôle of “spy,”
scrutinised her highness closely through the glasses. “That is almost
on a par with your speech to the Princess M——, one of the stories
she always tells to show what a bear you are, sir!”
“I do not remember saying anything to the Princess M——,” said
Hugh, laying down the lorgnette.
“You don’t remember her playing to you, and your saying that you
had never cared for any playing except that of a relation of yours?”
“No,” said Hugh, who was beginning to think deeply on the subject
of his new “case;” and his thoughts were curious, and to him utterly
unexpected. “But what did I say to you that was bearish just now,
Lady Forwood? I don’t care if her Royal Highness tells anecdotes
about me or not—it amuses her, and doesn’t harm me. But I cannot
be misunderstood by you.”
“That pretty speech makes up for the rude one,” said Lady
Forwood, smiling. “You seemed surprised that Mercedes and I were
girl friends. Of course I am her senior by some years. I will tell you
how it was. Her parents were anxious about her as a child, she was
such a delicate, mopy little thing. So they sent her to a convent
school at the seaside in England. I was what you might call a sixth-
form girl when she came; and, as the nuns thought me steady-going,
they gave her to me to look after specially. I was to be a sort of
deputy-mamma; and she grew very fond of me, poor little thing!”
“Why do you say ‘poor little thing’?” asked Hugh.
“Oh, Mercedes has always been peculiar,” said Lady Forwood.
“The nuns thought her cold and apathetic. I knew very differently!
There is fire underneath that cold manner of hers—she is the most
passionate girl, I think, I ever met! And her parents have been idiots
enough to marry her to that man!”
“You do not approve of the prince?” asked Hugh.
“Hush! We really must not talk any more, people will notice us,”
said Lady Forwood, directing her lorgnettes towards the stage, where
the prima-donna had just finished an air which was evidently greatly
to the taste of the pit and gallery.
Hugh leaned back and during the remainder of the first act
watched the Princess Andriocchi as narrowly as he could without
being specially noticed.
She sat perfectly still at first, leaning back, her white profile
cameo-like against the crimson curtain, her hands lying listlessly in
her lap. She appeared to be watching the stage, but in reality her eyes
were more than half veiled by their heavy lids. Through the glass he
could see that her exquisite little ears were transparent as wax.
“Poor child!” thought Hugh, compassionately. He thought he knew
now why the great B—— S—— and the clever Dr. Foster could neither
of them relieve the little princess of her malaise. The cause was
mental.
He had almost arrived at a resolution to “get out of the affair,” if he
possibly could, when (to his absent mind, with a strange suddenness)
down came the curtain upon the first act among the plaudits of the
house, and people began to move and stand up; there was a general
air of awakening to life of the attentive audience.
“Well,” said Lady Forwood, turning to him, “you must confess it is
a charming opera! The next thing to be done is to take me over to see
Mercedes.”
But this Hugh steadily refused to do.
Lady Forwood was still endeavouring to persuade him by all the
arguments at her command, when the box-door opened, and the
count entered.
He bowed profoundly to Lady Forwood, and offered his hand
deferentially to Hugh, who scrutinised him with a new misgiving.
Was this man who shadowed the young pair in any way connected
with that young creature’s unhappiness? He was, certainly, the sort
of man that some women would consider fascinating, with his
persuasive manners and his fair, handsome face.
He had brought a message to Lady Forwood: the princess wished
to come round to her box—would it be convenient?
Lady Forwood clapped her hands with evident delight.
Hugh had not known her in this childlike, unaffected mood.
“Convenient? Splendid!” she said to the count, who at once
vanished.
“Could anything be better?” she asked Hugh. “You will see her just
as she really is when she is talking to her ‘mammy,’ as she calls me.
What is the matter?” she said, suddenly, in a changed voice, for she
saw her pale friend wince and bite his lip.
“Nothing, I assure you,” he said, earnestly, recovering himself.
That word “mammy” had not been heard by him since Lilia had last
addressed Mrs. Mervyn by the tender nickname in his presence.
What seeming trifles are the feather-weights that balance human
destinies! But for the effect produced upon Hugh by that one word,
he would have made an excuse, and missed——
What? As he stood hesitating, the box-door opened, and the
princess came in.
A girl, with the carriage of a young queen.
Hugh stood back, and stared at the beautiful, dark young creature,
in her magnificent robe of white velvet, embroidered with seed
pearls, with but one feeling—amazement.
The princess gave him a careless glance, with a half-nod, in return
for his obeisance, as Lady Forwood introduced him, and seated
herself by her friend.
She murmured something in a low voice to Lady Forwood, upon
which the English lady blushed and looked annoyed. After some
whispering, Lady Forwood turned to Hugh with a beseeching look.
“I am going to test your friendship to the utmost,” she said,
pleadingly. “I am half afraid to ask you, but you will understand,” she
added, meaningly. “I want you to go down and see if Sir David has
arrived; there is nothing particular to hear for the next ten minutes.”
“With pleasure,” said Hugh, understanding that the little princess
had some secret to tell her friend, and that he was not wanted for the
next quarter-of-an-hour.
“A spoilt beauty,” he thought, as he strolled along the lobbies. “I
should like to know how any physician can cure that, unless he
inoculates her with the smallpox!”
He had hardly left the box before the princess’ manner changed.
She clasped her friend’s hand, and with her lovely face all quivering,
the corners of her lips drooping, and her great eyes full of tears, she
almost sobbed:
“Oh, mammy, mammy! It is true!—it is true!”
“My dear, what is true? You have been thinking such strange
things!” said Lady Forwood, distressed and worried, for she loved the
unhappy little creature. “You have got some silly notions into your
head, and you imagine all sorts of nonsense.”
“Listen!” said Mercedes, glancing round and speaking low. “To-day
he told me that he and the count would go on the river. I had to go to
the Court alone. Well, I thought I would ask the ambassadress to
take me—it would be not so long—she has the entrée, as you call it.
She did take me. Coming back, my carriage got into a number of
other carriages, and I saw—him.”
“The prince? Well, why not?” asked Lady Forwood.
“I saw him—and her—the woman whose portrait I found!” said
Mercedes, in a tone of anguish.
“Well, my dear,”—Lady Forwood spoke in a matter-of-fact manner,
although she was anathematising the prince for his flagrant conduct
in being publicly seen with the beautiful French actress whose name
had been coupled with his in society gossip—“I daresay he will be
able to explain it all to you, if, indeed, you were not mistaken.”
“How—explain?” asked Mercedes, bitterly. “How explain a lie,
mammy?”
“Hush!” said Lady Forwood, uneasily. “My dear, I never should
have worried David if I had seen him with fifty women!”
“That—is different!” said the princess. “Mammy, you love each
other!”
Lady Forwood began a brisk lecture:
“My child, you are not fit to be out in the world at all,” she said.
“You ought to have come to me for a year’s instruction before you
were married, instead of going straight to the altar from the convent.
You know absolutely nothing about men. Men’s ways are not
women’s ways. The world allows them their liberty; and if their wives
don’t allow it them also, they will neglect their wives for the world,
and the wives will be to blame.”
And she held forth on this somewhat loose doctrine so subtly that
the princess’ expression gradually changed from grieved perplexity
to a sort of placid resignation.
“A man is not bad who allows a lady acquaintance to take him
some distance in her carriage,” went on Lady Forwood, didactically.
“You will be wiser by-and-by, darling. You will take it for granted
that men are better than they seem.”
“The count is good,” said Mercedes, sorrowfully. “He is so kind to
me!”
“The count is no better than his neighbours,” said Lady Forwood,
sharply, feeling that from Scylla she was nearing Charybdis.
“Mercedes, you must rouse yourself, and go into society. Then you
will not brood on the subject of your husband. You can’t change him,
at least, not all of a sudden, so you must put up with him.”
“The count says——” began Mercedes.
“Don’t talk about the count to me! You know my opinion of
Italians, my dear. You shall be introduced to some Englishmen. You
must know this friend of ours, that you made me turn out of the box
just now. David says he is the best man he ever met.”
At this moment Hugh knocked at the box-door. He had been
outside in the cool night. He had not seen Sir David; he had not
expected to do so. He had watched the arrival of some late comers,
and, unnoticed by them, had seen the Prince Andriocchi and his
friend the count come out of the opera house, light their cigarettes,
and remain in close conversation for a few minutes, after which they
interchanged a glance of intelligence; the prince hailed a hansom and
drove off, and the count reentered the theatre.
So he interpreted the steady gaze which Mercedes fixed upon him
as he told Lady Forwood there was no sign of her husband’s arrival
as a mute questioning as to the whereabouts of the prince, the count
having established himself alone in the opposite box.
And the next occurrence startled him. The curtain was rising; he
was turning to take his seat at the back of the box, when the princess
suddenly leant towards Lady Forwood:
“Mammy, I have seen this—gentleman—before!” she said.
“Where?” she added, turning to Hugh.
He smiled, amused at the startled look in her gazelle eyes.
“You have the advantage of me, princess,” he said. “I do not think I
have had the honour of meeting you before to-night. And yet——”
He was puzzled. Looking at her steadily, there was something in
the wistful, childish beauty of Mercedes’ oval face which was
familiar. She had some resemblance to someone he had seen
somewhere. But, even as he ransacked his memory, the likeness
eluded him, as a forgotten name will refuse to repeat itself when the
thinker struggles to recall it.
“You two had better talk over your previous acquaintance behind
the curtain, I think,” said Lady Forwood.
Hugh took the hint. He drew his chair nearer to the princess, and
asked her where they possibly could have met, while Lady Forwood
became absorbed in the performance.
“You have been much in England; anyone can tell that who hears
you speak,” he said. “But have you been in London?”
“Never, till now,” said Mercedes, still scrutinising him with a
feeling of uneasiness, for she felt that this worn-looking but
attractive man, with the prematurely white hair, was no stranger to
her, yet she could not recall how or when she had seen him. “I have
lived seven—no, eight years in the convent at B——. That is where
mammy and I were together” (with an affectionate look towards her
friend); “but to London I came—not—once! When I returned to
Spain, we went by Newhaven. This is the first time I see—London.”
“Curious!” said Hugh, half to himself.
The resemblance to someone he had known was stronger while she
was speaking, and yet there was nothing definite about it. It stirred
him strangely; but what the emotion was which disturbed him and
quickened his ordinarily sluggish pulses, he could not tell.
“Were you ever in Surrey?” he suggested, after a few minutes’
fruitless mental searching.
“Never in any place here but the convent,” she said, decidedly.
“But you, sir. Perhaps you were in B—— sometime?”
“Never,” said Hugh.
“Then you have, perhaps, been in my country—in Spain?”
“Not yet,” said Hugh.
They both smiled; and then, suddenly remembering that they were
strangers, talked more reservedly of the music, which the princess
appeared to know well.
“I had the pianoforte score for a week,” she informed Dr. Paull.
“The composer lent me his manuscript. I played it for him when he
was in Madrid.”
She was telling Hugh of what was to come during the ensuing acts,
when the box-door opened, and the count came in.
“The prince requested me to escort you home at the end of the act,
madame la princesse,” he said in English, bowing very slightly to Dr.
Paull.
“But my husband? Where is he, monsieur?”
The count shrugged his shoulders, with an appealing smile, to
Lady Forwood.
“He must go to the club for an hour, madame. When you arrive at
the house, he will without doubt be there.”
Mercedes sat silent till the close of the act, then she rose abruptly,
held out her hand to Lady Forwood, said “Adieu, monsieur,” with a
melancholy little smile, to Hugh, and left the box on the count’s arm.
“Well?” said Lady Forwood, eagerly, when the two were alone.
“Well?” he repeated, coolly.
Some glamour, under the influence of which he had unbent—had
forgotten his ordinary almost apathy to his surroundings—had
passed away. He was on guard again.
“Tell me frankly what you think of her. I love her so much!” said
Lady Forwood, eagerly and honestly.
“There is nothing the matter with her—physically,” said Hugh.
“But—mentally?”
“As I told her husband, I do not profess to cure the mind.”
“Do you not see how miserable she is, Dr. Paull? We must do
something for her,” said Lady Forwood, energetically. “You can, even
more than I. She wants friends. She wants some powerful mind to
control hers, and lead her to live her own life, without reference to
the prince. That wretched young man! He neglects her shamefully;
and how he can throw her with that count as he does—everyone is
talking about it!”
“My dear Lady Forwood, what can I do?” asked Hugh, helplessly.
Had she spoken to him thus before he had met Mercedes, he would
have thought she was taking leave of her senses. Oddly enough, now,
her appeal did not strike him as in any way peculiar. “I could see her
professionally, and give her a few hints; but I could not talk to her
openly, as you could,” he added, hesitatingly.
“What I want is for her to take an interest in something, Dr. Paull.
I don’t mean an ordinary interest—but something that will occupy
her energies, will distract her from brooding over her wrongs. Oh,
she is wronged, poor child! David thinks very badly of the prince. I
would not believe anything so dreadful of a fellow-creature. Oh, dear
me, here is David!”
A portly, pleasant-looking man, who seemed as if the world suited
him, and he it, came in with a “Hulloa! You don’t look best pleased to
see me, my dear! I don’t wonder. It isn’t often she gets you all to
herself, is it, Paull? Well, we’ve won. Majority of seventeen for our
motion.”
Sir David talked away about the debate just over; and as soon as he
could take leave, Hugh quitted the theatre.
Walking through the streets, under the dark night sky, he seemed
awakening from some vivid dream, in which he had behaved in a
manner in which he would certainly not have behaved when awake.
Letting himself in with his key, he rang for Jones.
“You can go to bed. I shall sit up to do some work,” he said.
“You will find the letters in the library, sir,” said Jones, with extra
gravity.
“Very well,” said Hugh. Then he flung himself into a chair, and
began to think.
“That girl and I have met before,” he mused. “But how?—when?
When I looked into her eyes, I felt she understood me ... and—I
understand her. What on earth induced Lady Forwood to ask me to
look after her?”
He almost laughed. Here, in the big, lonely house, which for years
had been as a hermitage to him, the idea of his being asked to
become mentor to a lovely Spanish princess seemed an absurdity.
“Let me see what Grantley has to say about Spain and the
Spaniards,” he said to himself, going to the book-shelves and taking
down a volume.
Captain Grantley was a patient of his, who had travelled in Spain,
and recorded his experiences in print. For the next half-hour Hugh
was reading about bullfights, romantic ruins seen by moonlight,
mantillas, dark-eyed beauties, unpleasant railway journeys, and
stuffy hostelries where the diet appeared to be garlic fried in oil.
Nothing seemed to remind him of his princess; but he was still
reading on, when a cab drove up, and there was a ring at the hall bell.
“At this hour!” (It was nearly midnight.) He went into the hall,
unbarred and opened the door:
“Father?” His lanky son stepped joyfully in. “Why, you look
surprised! Surely you got my letter?” he said, after depositing bags
and hampers in the hall.
“Your letter? No,” said Dr. Paull. Somehow, Ralph’s unexpected
arrival was a slight shock to him. “I thought you were not coming
back for a week yet,” he said, after they went into the dining-room.
“We were away more than the fortnight, father,” said the pale lad,
with a smile as sad as his dead young mother’s had been when her
morbid sensitiveness was wounded. “But—you don’t look well! You
have been worried into going to some dinner-party or another” (with
a glance at his father’s evening dress). “I must not go away again!
They will do for you among them!”
“I’m not dead yet, you see,” said Hugh, feeling a new
embarrassment.
Until now there had been a confidence between him and the
delicate lad, who looked at him with his lost Lilia’s eyes, which was
more like the mutual understanding between attached brothers than
that of father with son. For the first time Dr. Paull felt reluctant to
speak of his doings to Ralph.
“But you must want some supper,” he suggested. “I will call up one
of the servants—”
Ralph protested that he was not in the least hungry, and that he
had had some sandwiches at Derby Station, which was literally true,
although on his way from the terminus he had thought pleasantly of
the snug supper with his father, which he fully expected was in store
for him. His reception had effectually satisfied his youthful appetite.
“By the way, Jones said something about letters in the library; just
get them, will you? Perhaps yours may be among them. I have had an
extra-busy day—was interrupted at breakfast—hadn’t time to open
my letters,” said Hugh, uneasily.
Ralph hastened to execute his father’s command, and returned
with a bundle of letters in his hand.
“Here is yours—unopened—as you see,” said Dr. Paull, showing
Ralph his own letter, which he had neglected with the rest of his
morning’s correspondence. “It was a fortunate thing I had not gone
to bed.”
Ralph looked astonished. His father, the acmé of punctiliousness
in business, speaking so carelessly of a whole batch of unopened
letters! What could it mean?
“I have something to show you, father,” he said, gently. The poor
boy thought that the fortnight’s loneliness had wrought this change
in his beloved parent, whom he understood about as much as a
beetle understands an eagle. And he fetched in two small packing-
cases with lightly-fastened lids.
“There,” he said, “are they not beautiful? I made the ivy one
myself.”
He opened the cases and removed some wadding. Dr. Paull stared
with some perplexity at two wreaths—one of ivy, the other of white
lilies. Then he bit his lip—he remembered! For the first time since
Lilia’s death, he had not noted the approach of the anniversary of
that terrible day when his son’s baby-hand had held him back from
the one unforgivable sin—self-murder. On that day it had been his
custom to take Lilia’s son to her grave, and talk to him of his mother:
of what was best in her, that the memory of a mother should be even
more to the boy than the influence of that mother, had she lived.
This time—he had forgotten!
“They are beautiful, Ralph,” he said, placing his hand
affectionately on his boy’s shoulder. “Let us put them in a cool place,
and go to bed. We must be up early to-morrow.”
He had not counted these last days as days of the month. He had
made careless engagements for Tuesdays or Wednesdays, or other
days in the week; and to-morrow he had appointments with
important patients, and a consultation.
“It looks like decadence—strangely like decadence,” he told
himself, bitterly, as, looking in the glass, he noted the deep lines on
his face, the haggard look in his eyes. “I did not remember the
twenty-first; and now I must cancel everything to-morrow—for the
boy’s sake, I must be consistent—I must take him to his mother’s
grave. But—to let everything go to the wall! Well, it must be done.
But this shall be a lesson. No more fooling with princes and
princesses—solid, sensible work.”
A brave determination, Dr. Paull! But, when you made it, did Fate
smile, or shed a tear?