83% found this document useful (6 votes)
183 views

Full download Learning SQL Master SQL Fundamentals Alan Beaulieu pdf docx

Master

Uploaded by

akpanmetroll
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
83% found this document useful (6 votes)
183 views

Full download Learning SQL Master SQL Fundamentals Alan Beaulieu pdf docx

Master

Uploaded by

akpanmetroll
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Download the Full Version of textbook for Fast Typing at textbookfull.

com

Learning SQL Master SQL Fundamentals Alan Beaulieu

https://textbookfull.com/product/learning-sql-master-sql-
fundamentals-alan-beaulieu/

OR CLICK BUTTON

DOWNLOAD NOW

Download More textbook Instantly Today - Get Yours Now at textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

T SQL Fundamentals Itzik Ben-Gan

https://textbookfull.com/product/t-sql-fundamentals-itzik-ben-gan/

textboxfull.com

SQL Easy SQL Programming Database Management for Beginners


Your Step By Step Guide to Learning the SQL Database Felix
Alvaro
https://textbookfull.com/product/sql-easy-sql-programming-database-
management-for-beginners-your-step-by-step-guide-to-learning-the-sql-
database-felix-alvaro/
textboxfull.com

SQL Primer: An Accelerated Introduction to SQL Basics


Rahul Batra

https://textbookfull.com/product/sql-primer-an-accelerated-
introduction-to-sql-basics-rahul-batra/

textboxfull.com

SQL Server Execution Plans For SQL Server 2008 through to


2017 and Azure SQL Database 3rd Edition Grant Fritchey

https://textbookfull.com/product/sql-server-execution-plans-for-sql-
server-2008-through-to-2017-and-azure-sql-database-3rd-edition-grant-
fritchey/
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

Azure SQL Revealed: A Guide to the Cloud for SQL Server


Professionals Bob Ward

https://textbookfull.com/product/azure-sql-revealed-a-guide-to-the-
cloud-for-sql-server-professionals-bob-ward/

textboxfull.com

SQL Cookbook: Query Solutions and Techniques for All SQL


Users 2nd Edition Anthony Molinaro

https://textbookfull.com/product/sql-cookbook-query-solutions-and-
techniques-for-all-sql-users-2nd-edition-anthony-molinaro/

textboxfull.com

SQL Server 2019 Revealed: Including Big Data Clusters and


Machine Learning Bob Ward

https://textbookfull.com/product/sql-server-2019-revealed-including-
big-data-clusters-and-machine-learning-bob-ward/

textboxfull.com

Expert SQL Server Transactions and Locking: Concurrency


Internals for SQL Server Practitioners 1st Edition Dmitri
Korotkevitch
https://textbookfull.com/product/expert-sql-server-transactions-and-
locking-concurrency-internals-for-sql-server-practitioners-1st-
edition-dmitri-korotkevitch/
textboxfull.com
1. Preface
a. Why Learn SQL?
b. Why Use This Book to Do It?
c. Structure of This Book
d. Conventions Used in This Book
e. Using Code Examples
f. O’Reilly Online Learning
g. How to Contact Us
2. 1. A Little Background
a. Introduction to Databases

i. Nonrelational Database Systems


ii. The Relational Model
iii. Some Terminology
b. What Is SQL?

i. SQL Statement Classes


ii. SQL: A Nonprocedural Language
iii. SQL Examples

c. What Is MySQL?
d. SQL Unplugged
e. What’s in Store

3. 2. Creating and Populating a Database


a. Creating a MySQL Database
b. Using the mysql Command-Line Tool
c. MySQL Data Types
i. Character Data
ii. Numeric Data
iii. Temporal Data
d. Table Creation

i. Step 1: Design
ii. Step 2: Refinement
iii. Step 3: Building SQL Schema
Statements
e. Populating and Modifying Tables

i. Inserting Data
ii. Updating Data
iii. Deleting Data
f. When Good Statements Go Bad

i. Nonunique Primary Key


ii. Nonexistent Foreign Key
iii. Column Value Violations
iv. Invalid Date Conversions

g. The Sakila Database


4. 3. Query Primer
a. Query Mechanics
b. Query Clauses
c. The select Clause

i. Column Aliases
ii. Removing Duplicates

d. The from Clause

i. Tables
ii. Table Links
iii. Defining Table Aliases

e. The where Clause


f. The group by and having Clauses
g. The order by Clause

i. Ascending Versus Descending Sort


Order
ii. Sorting via Numeric Placeholders

h. Test Your Knowledge


i. Exercise 3-1
ii. Exercise 3-2
iii. Exercise 3-3
iv. Exercise 3-4
5. 4. Filtering
a. Condition Evaluation
i. Using Parentheses
ii. Using the not Operator
b. Building a Condition
c. Condition Types

i. Equality Conditions
ii. Range Conditions
iii. Membership Conditions
iv. Matching Conditions
d. Null: That Four-Letter Word
e. Test Your Knowledge

i. Exercise 4-1
ii. Exercise 4-2
iii. Exercise 4-3
iv. Exercise 4-4
6. 5. Querying Multiple Tables

a. What Is a Join?
i. Cartesian Product
ii. Inner Joins
iii. The ANSI Join Syntax

b. Joining Three or More Tables


i. Using Subqueries As Tables
ii. Using the Same Table Twice
c. Self-Joins
d. Test Your Knowledge
i. Exercise 5-1
ii. Exercise 5-2
iii. Exercise 5-3
7. 6. Working with Sets

a. Set Theory Primer


b. Set Theory in Practice
c. Set Operators

i. The union Operator


ii. The intersect Operator
iii. The except Operator
d. Set Operation Rules

i. Sorting Compound Query Results


ii. Set Operation Precedence
e. Test Your Knowledge

i. Exercise 6-1
ii. Exercise 6-2
iii. Exercise 6-3
8. 7. Data Generation, Manipulation, and Conversion

a. Working with String Data


i. String Generation
ii. String Manipulation
b. Working with Numeric Data
i. Performing Arithmetic Functions
ii. Controlling Number Precision
iii. Handling Signed Data

c. Working with Temporal Data


i. Dealing with Time Zones
ii. Generating Temporal Data
iii. Manipulating Temporal Data

d. Conversion Functions
e. Test Your Knowledge
i. Exercise 7-1
ii. Exercise 7-2
iii. Exercise 7-3
9. 8. Grouping and Aggregates
a. Grouping Concepts
b. Aggregate Functions

i. Implicit Versus Explicit Groups


ii. Counting Distinct Values
iii. Using Expressions
iv. How Nulls Are Handled

c. Generating Groups
i. Single-Column Grouping
ii. Multicolumn Grouping
iii. Grouping via Expressions
iv. Generating Rollups
d. Group Filter Conditions
e. Test Your Knowledge

i. Exercise 8-1
ii. Exercise 8-2
iii. Exercise 8-3
10. 9. Subqueries

a. What Is a Subquery?
b. Subquery Types
c. Noncorrelated Subqueries

i. Multiple-Row, Single-Column
Subqueries
ii. Multicolumn Subqueries

d. Correlated Subqueries

i. The exists Operator


ii. Data Manipulation Using Correlated
Subqueries

e. When to Use Subqueries


i. Subqueries As Data Sources
ii. Subqueries As Expression Generators
f. Subquery Wrap-up
g. Test Your Knowledge

i. Exercise 9-1
ii. Exercise 9-2
iii. Exercise 9-3
11. 10. Joins Revisited

a. Outer Joins

i. Left Versus Right Outer Joins


ii. Three-Way Outer Joins
b. Cross Joins
c. Natural Joins
d. Test Your Knowledge
i. Exercise 10-1
ii. Exercise 10-2
iii. Exercise 10-3 (Extra Credit)
12. 11. Conditional Logic

a. What Is Conditional Logic?


b. The Case Expression

i. Searched Case Expressions


ii. Simple Case Expressions
c. Case Expression Examples

i. Result Set Transformations


ii. Checking for Existence
iii. Division-by-Zero Errors
iv. Conditional Updates
v. Handling Null Values
d. Test Your Knowledge

i. Exercise 11-1
ii. Exercise 11-2
13. 12. Transactions

a. Multiuser Databases
i. Locking
ii. Lock Granularities

b. What Is a Transaction?

i. Starting a Transaction
ii. Ending a Transaction
iii. Transaction Savepoints

c. Test Your Knowledge


i. Exercise 12-1

14. 13. Indexes and Constraints

a. Indexes

i. Index Creation
ii. Types of Indexes
iii. How Indexes Are Used
iv. The Downside of Indexes
b. Constraints

i. Constraint Creation

c. Test Your Knowledge

i. Exercise 13-1
ii. Exercise 13-2
15. 14. Views
a. What Are Views?
b. Why Use Views?

i. Data Security
ii. Data Aggregation
iii. Hiding Complexity
iv. Joining Partitioned Data

c. Updatable Views

i. Updating Simple Views


ii. Updating Complex Views

d. Test Your Knowledge


i. Exercise 14-1
ii. Exercise 14-2

16. 15. Metadata

a. Data About Data


b. Information_Schema
c. Working with Metadata

i. Schema Generation Scripts


ii. Deployment Verification
iii. Dynamic SQL Generation
d. Test Your Knowledge

i. Exercise 15-1
ii. Exercise 15-2
17. 16. Analytic Functions

a. Analytic Function Concepts

i. Data Windows
ii. Localized Sorting

b. Ranking
i. Ranking Functions
ii. Generating Multiple Rankings

c. Reporting Functions

i. Window Frames
ii. Lag and Lead

d. Test Your Knowledge


i. Exercise 16-1
ii. Exercise 16-2
iii. Exercise 16-3

18. 17. Working with Large Databases


a. Partitioning

i. Partitioning Concepts
ii. Table Partitioning
iii. Index Partitioning
iv. Partitioning Methods
v. Partitioning Benefits

b. Sharding
c. Big Data

i. Hadoop
ii. NoSQL and Document Databases
iii. Cloud Computing
iv. Future of SQL
19. 18. SQL and Big Data

a. Apache Drill
b. Drill and MySQL
c. Drill and MongoDB
d. Drill with Multiple Data Sources
Learning SQL
THIRD EDITION

Generate, Manipulate, and Retrieve Data

With Early Release ebooks, you get books in their earliest form—the author’s
raw and unedited content as they write—so you can take advantage of these
technologies long before the official release of these titles.

Alan Beaulieu
Learning SQL

by Alan Beaulieu

Copyright © 2020 Alan Beaulieu. 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://oreilly.com/safari). For more information,
contact our corporate/institutional sales department: 800-998-
9938 or corporate@oreilly.com.

Acquisitions Editor: Jessica Haberman

Development Editor: Jeff Bleiel

Production Editor: Deborah Baker

Interior Designer: David Futato

Cover Designer: Karen Montgomery

Illustrator: Rebecca Demarest

May 2020: Third Edition


Revision History for the Early Release
2019-12-11: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781492057611
for release details.

The O’Reilly logo is a registered trademark of O’Reilly Media,


Inc. Learning SQL, the cover image, and related trade dress
are trademarks of O’Reilly Media, Inc.

The views expressed in this work are those of the author, and
do not represent the publisher’s views. 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-492-05754-3

[LSI]
Preface
Programming languages come and go constantly, and very few
languages in use today have roots going back more than a
decade or so. Some examples are Cobol, which is still used
quite heavily in mainframe environments, and C, which is still
quite popular for operating system and server development
and for embedded systems. In the database arena, we have
SQL, whose roots go all the way back to the 1970s.

SQL is the language for generating, manipulating, and


retrieving data from a relational database. One of the reasons
for the popularity of relational databases is that properly
designed relational databases can handle huge amounts of
data. When working with large data sets, SQL is akin to one of
those snazzy digital cameras with the high-power zoom lens in
that you can use SQL to look at large sets of data, or you can
zoom in on individual rows (or anywhere in between). Other
database management systems tend to break down under
heavy loads because their focus is too narrow (the zoom lens is
stuck on maximum), which is why attempts to dethrone
relational databases and SQL have largely failed. Therefore,
even though SQL is an old language, it is going to be around
for a lot longer and has a bright future in store.
Why Learn SQL?
If you are going to work with a relational database, whether
you are writing applications, performing administrative tasks,
or generating reports, you will need to know how to interact
with the data in your database. Even if you are using a tool
that generates SQL for you, such as a reporting tool, there may
be times when you need to bypass the automatic generation
feature and write your own SQL statements.

Learning SQL has the added benefit of forcing you to confront


and understand the data structures used to store information
about your organization. As you become comfortable with the
tables in your database, you may find yourself proposing
modifications or additions to your database schema.
Why Use This Book to Do It?
The SQL language is broken into several categories.
Statements used to create database objects (tables, indexes,
constraints, etc.) are collectively known as SQL schema
statements. The statements used to create, manipulate, and
retrieve the data stored in a database are known as the SQL
data statements. If you are an administrator, you will be using
both SQL schema and SQL data statements. If you are a
programmer or report writer, you may only need to use (or be
allowed to use) SQL data statements. While this book
demonstrates many of the SQL schema statements, the main
focus of this book is on programming features.

With only a handful of commands, the SQL data statements


look deceptively simple. In my opinion, many of the available
SQL books help to foster this notion by only skimming the
surface of what is possible with the language. However, if you
are going to work with SQL, it behooves you to understand
fully the capabilities of the language and how different features
can be combined to produce powerful results. I feel that this is
the only book that provides detailed coverage of the SQL
language without the added benefit of doubling as a “door
stop” (you know, those 1,250-page “complete references” that
tend to gather dust on people’s cubicle shelves).

While the examples in this book run on MySQL, Oracle


Database, and SQL Server, I had to pick one of those products
to host my sample database and to format the result sets
returned by the example queries. Of the three, I chose MySQL
because it is freely obtainable, easy to install, and simple to
administer. For those readers using a different server, I ask
that you download and install MySQL and load the sample
database so that you can run the examples and experiment
with the data.

Structure of This Book


This book is divided into 15 chapters and 3 appendixes:

Chapter 1, explores the history of computerized


databases, including the rise of the relational model
and the SQL language.

Chapter 2, demonstrates how to create a MySQL


database, create the tables used for the examples in
this book, and populate the tables with data.

Chapter 3, introduces the selectstatement and


further demonstrates the most common clauses
(select, from, where).
Chapter 4, demonstrates the different types of
conditions that can be used in the whereclause of a
select, update, or deletestatement.

Chapter 5, shows how queries can utilize multiple tables


via table joins.

Chapter 6, is all about data sets and how they can


interact within queries.

Chapter 7, demonstrates several built-in functions used


for manipulating or converting data.

Chapter 8, shows how data can be aggregated.

Chapter 9, introduces the subquery (a personal


favorite) and shows how and where they can be
utilized.
Chapter 10, further explores the various types of table
joins.

Chapter 11, explores how conditional logic (i.e., if-then-


else) can be utilized in select, insert, update, and
deletestatements.

Chapter 12, introduces transactions and shows how to


use them.

Chapter 13, explores indexes and constraints.

Chapter 14, shows how to build an interface to shield


users from data complexities.

Chapter 15, demonstrates the utility of the data


dictionary.

Appendix A shows the database schema used for all


examples in the book.

Appendix B demonstrates some of the interesting non-


ANSI features of MySQL’s SQL implementation.

Appendix C shows solutions to the chapter exercises.

Conventions Used in This Book


The following typographical conventions are used in this book:

Italic

Used for filenames, directory names, and URLs. Also used


for emphasis and to indicate the first use of a technical
term.

Constant width

Used for code examples and to indicate SQL keywords


within text.

Constant width italic

Used to indicate user-defined terms.

plainUPPERCASE
Used to indicate SQL keywords within example code.

Constant width bold

Indicates user input in examples showing an interaction.


Also indicates emphasized code elements to which you
should pay particular attention.

NOTE
Indicates a tip, suggestion, or general note. For example, I use notes to
point you to useful new features in Oracle9i.

WARNING
Indicates a warning or caution. For example, I’ll tell you if a certain SQL
clause might have unintended consequences if not used carefully.

Using Code Examples


This book is here to help you get your job done. In general, if
example code is offered with this book, you may use it in your
programs and documentation. You do not need to contact us
for permission unless you’re reproducing a significant portion
of the code. For example, writing a program that uses several
chunks of code from this book does not require permission.
Selling or distributing 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 significant amount of example code from this
book into your product’s documentation does require
permission.

We appreciate, but generally do not require, attribution. An


attribution usually includes the title, author, publisher, and
ISBN. For example: “Learning SQL, Third Edition, by Alan
Beaulieu. Copyright 2020 Alan Beaulieu, 978-1-492-05761-1.”

If you feel your use of code examples falls outside fair use or
the permission given above, feel free to contact us at
permissions@oreilly.com.

O’Reilly Online Learning

NOTE
For more than 40 years, O’Reilly has provided technology and business
training, knowledge, and insight to help companies succeed.

Our unique network of experts and innovators share their


knowledge and expertise through books, articles, conferences,
and our online learning platform. O’Reilly’s online learning
platform gives you on-demand access to live training courses,
in-depth learning paths, interactive coding environments, and a
vast collection of text and video from O’Reilly and 200+ other
publishers. For more information, please visit
http://oreilly.com.

How to Contact Us
Please address comments and questions concerning this book
to the publisher:

O’Reilly Media, Inc.

1005 Gravenstein Highway North

Sebastopol, CA 95472

800-998-9938 (in the United States or Canada)

707-829-0515 (international or local)

707-829-0104 (fax)

We have a web page for this book, where we list errata,


examples, and any additional information. You can access this
page at http://www.oreilly.com/catalog/9781492057611.

Emails us with comments or technical questions at


bookquestions@oreilly.com.

For more information about our books, courses, conferences,


and news, see our website 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


Chapter 1. A Little
Background
Before we roll up our sleeves and get to work, it would be
helpful to survey the history of database technology in order to
better understand how relational databases and the SQL
language evolved. Therefore, I’d like to start by introducing
some basic database concepts and looking at the history of
computerized data storage and retrieval.

NOTE
For those readers anxious to start writing queries, feel free to skip ahead
to Chapter 3, but I recommend returning later to the first two chapters in
order to better understand the history and utility of the SQL language.

Introduction to Databases
A database is nothing more than a set of related information. A
telephone book, for example, is a database of the names,
phone numbers, and addresses of all people living in a
particular region. While a telephone book is certainly a
ubiquitous and frequently used database, it suffers from the
following:
Finding a person’s telephone number can be time-
consuming, especially if the telephone book contains a
large number of entries.

A telephone book is indexed only by last/first names,


so finding the names of the people living at a particular
address, while possible in theory, is not a practical use
for this database.

From the moment the telephone book is printed, the


information becomes less and less accurate as people
move into or out of a region, change their telephone
numbers, or move to another location within the same
region.

The same drawbacks attributed to telephone books can also


apply to any manual data storage system, such as patient
records stored in a filing cabinet. Because of the cumbersome
nature of paper databases, some of the first computer
applications developed were database systems, which are
computerized data storage and retrieval mechanisms. Because
a database system stores data electronically rather than on
paper, a database system is able to retrieve data more quickly,
index data in multiple ways, and deliver up-to-the-minute
information to its user community.

Early database systems managed data stored on magnetic


tapes. Because there were generally far more tapes than tape
readers, technicians were tasked with loading and unloading
Other documents randomly have
different content
CHAPTER X
TIT FOR TAT

After that it was a comparatively easy matter to get Henry Stowell


to tell the details of what had been done. Several times Dock Wesley
tried to stop him, but finally he also capitulated and became almost
as humble as the sneak.
“It was only a bit of fun,” said Wesley. “Can’t a fellow do something
on the last night at school?”
“Sure!” answered Fred.
“But you’ve got to take your dose in return,” was Fatty Hendry’s
comment.
Thereupon Codfish and Wesley admitted that they and four other
cadets had entered the rooms occupied by the Rovers and their
chums and taken away all their clothing and their bed things.
“Everything is locked up safe and sound in Room Forty-two,” said
Codfish. “You know, that room hasn’t been occupied this term.”
“How did you get the key?” asked Andy.
“We got it one day from the janitor when he was cleaning up. He
thought he had lost it, and so locked up with a duplicate.”
“Where is the key now?” asked Jack.
“I—I let Dock keep it,” faltered Codfish.
“Say, you needn’t put off everything on me,” growled Wesley. “You
had as much to do with this as anybody. The key is on a hook in that
closet,” and Wesley nodded toward a closet in a corner.
“Now we want to know who the other fellows were,” declared Fred,
after the key had been secured.
“Oh, you had better not ask that,” pleaded the sneak. “If we give
them away they may hammer the daylights out of us.”
“You talk up, Codfish, or you may get the hammering right now,”
put in Gif.
Thereupon Codfish mentioned the names of four cadets who had
been more or less chummy with him since the term had started. Two
were new boys, and all were fellows with whom the Rovers and their
chums had had little to do.
“Now put on your slippers and come along with us,” ordered Jack.
“What do you want of us?” questioned Wesley.
“First of all, you’re going to bring all that stuff back,” declared the
young major. “After that we’ll see what we’ll do.”
“Why don’t you make the other fellows join us?” asked Codfish. He
thought there might be safety in numbers.
“We’ll take care of them later on,” put in Gif grimly.
Finding themselves cornered, Codfish and Wesley accompanied
the others to Room 42, and there on the bed, on the chairs, and on
the floor they found all the things taken from the Rovers and Gif and
Spouter.
“I call this something of a mess,” declared Fatty, who had come
along. “Here, give me some of that clothing! I’ll help carry it.”
Even with the assistance of those who had suffered from the joke,
it was necessary to make several trips back and forth to get all the
things where they belonged. During the last trip Fred and Andy
noticed some other cadets hiding in the shadows at the end of the
corridor and laughing softly among themselves.
“They think they’ve got the joke on us,” whispered Fred. “Come
on, let us make a break for them.”
“Not yet. I’ve got a better plan,” came from Randy.
After everything had been restored to the rooms, the Rovers and
their chums marched Codfish and Wesley back to their own
quarters.
“Now then, I think we’ll give you a dose of your own medicine,”
said the young major. “Boys, pick up all that extra clothing and all
those quilts and bedsheets and put them in the closet over there.”
“Say, what does this mean?” demanded Wesley.
“You’ll see in a minute.”
The others were quick to catch the idea, and all the bed coverings,
as well as the wearing apparel in the room, were quickly transferred
to the closet.
“We’ll leave you your pajamas, for you might catch cold,” said
Randy. Then the closet door was locked and the key taken away.
“Now, don’t try to raise a row, or you’ll be sure to get the worst of
it,” said Jack, as the crowd prepared to leave the room.
“We can’t stay here with nothing on the beds!” cried Codfish.
“You thought we could do it, didn’t you?” asked Andy. “It’s simply tit
for tat. Go on and lie down and enjoy yourselves.” And thereupon the
Rovers and their chums withdrew, locking the door after them.
“I guess that will hold them for a while,” remarked Spouter. “They
can’t get their things unless they break open the door, and I don’t
think they’ll go that far. And they can’t get out unless they go on the
fire escape, and the door from there to the corridor is locked on the
inside—they’d have to go through some of the other fellows’ rooms.”
“Now then, how are we going to square up with those other
fellows?” asked Gif.
“I was thinking I might sneak down and get old Huxley’s garden
syringe—the one he uses to spray the bushes and flowers with,” said
Andy. “We might give ’em all a dose of ice-water, or something like
that.”
“Old stuff,” declared Fred. “Can’t we think of something new?”
“We might blow some smoke through the keyholes or under the
doors,” suggested Randy. “Then we could bang on the door and let
them think there was a fire.”
“Gosh! that isn’t half bad,” said Fred. “But how shall we make the
smoke? We can’t build a fire, or anything of that sort.”
“Some wet paper will do the trick.”
“I don’t think you ought to try that, boys,” declared Jack. “It might
bring on a panic, and we don’t want any one to be hurt on this, the
last night at the Hall. Come on and see if we can’t get hold of those
fellows.”
They passed around a corner of the corridor, and as they did so
Gif suddenly clutched the youngest Rover by the arm.
“There go some fellows now!” he whispered. “See them crawling
along over there? I wonder who they are and what they’re up to?”
The lights in the hallway had been turned low, and the Rovers and
their chums could just make out the forms of four cadets slinking
along silently. Then they disappeared from view around one of the
numerous corners.
Curious to know what new fun might be in the air, the Rovers and
the others followed the crowd like so many shadows. They saw the
four cadets who were ahead stop in front of the room which they had
left but a few moments before.
“Gee, I know that crowd!” exclaimed Andy, in a low voice. “Those
are the very fellows Codfish and Wesley mentioned—the fellows
who helped them take our things.”
“They must be wanting to know what we were doing here,”
suggested Gif. “Say, why can’t we pounce on ’em and make ’em
prisoners? We are seven to four.”
“I’m game if you fellows are,” answered Randy readily.
A plan was hastily formed, and just as the four cadets had begun
their talk with Codfish and Wesley, out of the semi-darkness pounced
the Rovers and their chums.
“Give in! Give in!” was the whispered command. “Give in or you’ll
get the licking of your lives!”
“Hi! Stop that!” roared one of the cadets, a lad named Morris. “Let
up!”
“Do-do-don’t ch-choke me to death!” spluttered a cadet named
Shamberg. “Let up, I tell you!”
“It’s the Rovers!” came from a third of the lads.
“They’ve found us out!” wailed the fourth, a fellow who was just as
much of a sneak and coward as Codfish had ever been.
Surrounded and taken completely off their guard, the four cadets
were speedily made prisoners. Then, almost before they knew what
was happening, they were taken to the two adjoining rooms which
they chanced to occupy. One of the rooms had a rather large closet
which at one time had been a storeroom. It had a small window
about five feet from the ground.
“I’ve got an idea,” said Jack. “Throw a mattress in here on the
floor.”
The others quickly caught on and in a trice a mattress from one of
the beds was flung on the floor of the storeroom. Then the four
cadets who had been captured were forced into the place.
“Now you fellows can stay here until morning,” declared Jack. “You
didn’t want us to have a decent night’s sleep, so now you can get
along in any old way you please. Don’t dare to make a rumpus, or
we’ll be after you in a way you least expect.”
“Gee, we’ll smother to death in here this warm night!” declared
Morris.
“No, you won’t,” said Spouter. “You can take turns at looking out of
the window. But I’d advise you not to crawl out, because it’s about
twenty-five feet to the ground.”
“We’ll report this to-morrow, you see if we don’t,” grumbled
Shamberg.
“Report and be hanged,” retorted Gif. “If you say a word to Colonel
Colby we’ll tell him what you did.” And thereupon the Rovers and
their chums withdrew, locking the storeroom door and then locking
the door to the corridor.
It was a good quarter of an hour after Gif, Spouter and Fatty had
left them that the Rovers were able to rearrange their beds so that
they could lie down. All were now thoroughly tired out and Andy
could scarcely keep his eyes open. But there was to be little sleep
for any of the cadets during that last night at Colby Hall. Half a dozen
parties were wandering around, making all the fun possible, and
presently Professor Snopper Duke came after some of the boys,
trying to quiet them.
“This is disgraceful!” stormed the irate teacher. “I want you boys to
keep quiet.”
Then came an alarm from Codfish and Wesley, as several other
cadets broke into their room, bent upon bringing the sneak and his
chum to terms for something done in the classroom the week before.
Into this row Snopper Duke precipitated himself, and as a
consequence was struck in the nose by a baseball which one of the
lads threw at Codfish.
“Oh, oh, my nose! Who threw that baseball?” roared the teacher.
Then, as the blood began to flow from the injured organ, he
hastened off to the nearest bathroom where he might bathe it.
It was all of three o’clock before the Rovers got any sleep at all. By
half past six they were again awake and busy packing their things,
ready to depart. Then Randy and Andy sneaked away and liberated
Morris, Shamberg and the other two with them.
“Hope you slept well,” said Andy, grinning.
“You let me get my hands on you, and I’ll show you how I slept,”
stormed Morris. But then Andy ran off laughing and his twin followed
him. The other boys were very sore, but did not dare to do anything.
“And now to get the girls and start for home!” said Jack, a short
while after breakfast.
“And then for our vacation!” added Fred. “If only we knew where it
was going to be!”
“You’ll know very soon,” declared Andy. “Randy and I have made
up our minds to tell you as soon as we are ready to leave Haven
Point.”
CHAPTER XI
A MYSTERIOUS PLOT

“Good-by, boys. I wish all of you the best of luck.”


It was Colonel Colby who spoke as he shook hands with the Rover
boys and a number of the other cadets.
“Good-by, Colonel. I hope we see you again some time,” returned
Jack.
“You must come and visit us at our home when you can get time,”
put in Fred.
“I will certainly come when I can get away,” was the reply from the
master of the school.
Breakfast was at an end and all was bustle and confusion as the
cadets were hurrying in all directions, suitcases in hand, ready to
leave the Hall. Many were going away in automobiles which lined
one side of the campus drive. Others were to go to the Haven Point
railroad station. A motor truck had already taken two loads of trunks
away and was now back for a third.
“Good-by, fellows!” cried Gif. “Hope you have a good time.” He
and Spouter had arranged to go up on the coast of Maine with Dan
Soppinger and their folks.
“Good-by!” cried the Rovers, and a few minutes later had entered
the touring car which was to take them away.
“Here is something to remember us by!” shouted Spouter gayly,
and threw a bunch of confetti over the Rovers.
“And here is something to remember me by!” yelled Andy, as the
car moved away and he hurled an old shoe he had picked up at
Spouter, catching that cadet in the stomach, causing him to give a
grunt of surprise. Then the touring car rolled out of the grounds, all of
the boys waving their hands as the place faded from their sight.
“Now it is good-by to Colby Hall and hurrah for a vacation!”
exclaimed Fred. Then he added quickly: “Now then, Andy and
Randy, where are we to go? Don’t keep me waiting any longer. I’m
all on fire with suspense,” and the youngest Rover put on a tragic air.
“Wait till we pick up the girls,” pleaded Andy. “No use in going over
the whole thing twice. They’ll want to know about it, anyway.”
It had already been arranged that Martha and Mary, along with
Ruth, were to accompany the lads to New York City. Although the
others did not know it, Jack went armed, having obtained the loan of
a pistol from Colonel Colby, who had been told the particulars
regarding the rascality of Carson Davenport.
“I feel that I am responsible for the safety of my sister and my
cousin,” the young major had told the master of the school. “I want to
be sure that they get home safely.” And thereupon Colonel Colby
had somewhat reluctantly permitted Jack to take his own private
nickel-plated pistol.
When the boys arrived at Clearwater Hall they found the three girls
waiting for them. A few minutes later the whole crowd was off for the
Haven Point railroad station.
“Have you seen or heard anything more of that man Davenport?”
questioned Mary anxiously, as they rode along.
“Not a thing, Mary,” answered her brother. “Have you?”
“Two or three times we saw somebody skulking in the bushes
back of the school,” said the girl. “It was rather dark, and the man
was so far off we couldn’t tell who he was, although Martha thought
he walked like the fellow who tried to push us into the auto.”
It took but a few minutes to reach the railroad station, and during
that time Andy and Randy had no opportunity to speak of the trip the
lads intended to take during their vacation. At the station they fell in
with a number of the cadets, including Phil Franklin.
“I’ve arranged to stay with Mrs. Logan,” said Phil. “And I think
Barry and I are going to have some bang-up times.”
“Don’t forget to look for the silver trophy,” said Jack quickly.
“Oh, I’ve already spoken to Barry about that,” answered the boy
from the oil fields. “We’re going to make a systematic hunt. Of
course, it isn’t going to be very easy to locate the exact spot where
the vase went down.”
“It was opposite that clump of big pines,” declared Randy. “I
noticed the pines just as I went overboard,” he added, with a sickly
grin.
“I’ll remember that—it ought to help us in locating the spot,” said
Phil, and then walked away to bid some of his other friends good-by.
“Now then, Andy and Randy, tell us where we’re going!” cried
Fred, when the Rover boys and girls and Ruth were left for a
moment to themselves.
“You’re going out West,” answered Andy dryly.
“Out West? Where?” came from Jack and Fred.
“You’re going out to the Rolling Thunder gold mine,” said Randy.
“Rolling Thunder! What a name!” exclaimed Ruth, dimpling.
“Where in thunder is Rolling Thunder?” demanded Fred. “I never
heard of such a gold mine.”
“I have,” put in Jack quickly. “It’s the one Uncle Tom invested in a
couple of years ago. I’m right, am I not?” he questioned of the twins.
“That’s it. It’s away out in the Rocky Mountains near a place called
Maporah. It’s on what is known as Sunset Trail.”
“Gee, that sounds good! Sunset Trail!” murmured Fred.
“How are we to go? In an auto?” queried Jack.
“Hardly! We’re to take the train to Chicago and then another train
to Maporah. From there we take horses and ride to a place called
Gold Hill Falls where the mine is located. Dad says we ought to have
a dandy time on Sunset Trail.”
“He says it’s a very wild country, with plenty of good hunting and
fishing, and all that sort of thing,” came from the other twin. “He says
we can go out either with a guide or by ourselves, just as we please.”
“That sounds mighty good to me,” said Fred, his eyes brightening.
“I’d like to spend a few weeks in the saddle, and I’d like to go where
there is some real fishing.”
“Suppose some Indians catch you and scalp you?” put in his sister
mischievously.
“Indians! Humph! If there are any Indians out there more than
likely some of them are from college and on the baseball or football
teams,” was the quick retort. “The old-fashioned Indians exist only in
the story books.”
The boys and girls became greatly interested in the subject of the
outing and talked about it freely until it was time for the train to arrive.
Then they bustled around to say good-by to those who were to leave
in the opposite direction.
“Gee, it makes me feel awfully queer to think I’m never coming
back to Colby Hall!” murmured Fred, as he shook hands with one
and another of the cadets.
“This place has certainly been a second home to us,” answered
Jack. “No matter what happens in the future, I’ll never forget the
days spent here.”
“None of us will!” cried Randy.
“They were great days, the best of days, in spite of such fellows as
Codfish, Gabe Werner, Bill Glutts, and Professor Duke,” declared the
young major.
The girls were likewise in a flutter bidding farewell to their chums
and also several of the teachers who were leaving. In the midst of all
this excitement the train rolled in and a few seconds later boys and
girls climbed aboard and the Rovers rushed down the aisle to get
comfortable seats.
“Good-by to Haven Point!” shouted Andy, out of the window, and
then opening a bag of popcorn he had purchased he scattered the
entire contents over the heads of those left behind.
“Oh, my, look at that!” was the cry. “Popcorn! Did you ever!”
“That was Andy Rover! He’s always cutting up!”
“Here you are, Andy!” yelled Phil Franklin, in excitement, and just
as the train started he sent a rubber ball whizzing through the open
window of the car. The ball struck Andy in the ear, then bounced
away into Ruth’s lap.
“Hi! We don’t want your ball!” called out Andy, and, catching it up,
he threw it through the window, hitting the cadet named Morris in the
chin. Then the train rolled away, and the journey to New York City
was begun.
As the train passed out of sight two men, one about middle age
and the other very much younger, stepped from a corner of a
baggage room which was located close to where the Rover boys and
those with them had been standing.
“I guess you got the right dope that time, Davenport,” said the
younger man, as both walked away unnoticed and entered a
roadster standing on a side road behind some bushes.
“I think I did,” answered Carson Davenport, his manner showing
his satisfaction. “So they are going to Chicago and then to Maporah,
and then out on Sunset Trail, eh? I’ll have to look into that.”
“Do you know anything about the Sunset Trail territory?”
questioned the younger man.
“I do and I don’t,” was Davenport’s reply. “I was never there
myself. But Tate, the fellow I’ve been telling you about, came from
that district and he’s often told me about it. He spoke about this
Rolling Thunder mine, too. He knows some of the fellows working
there.”
“Then what you’ve got in mind ought to be easy, Davenport.”
“I don’t know about its being so easy! Those Rovers are not fools
and since we made a mess of things the other day, more than likely
they’ll be on their guard. I reckon I made something of a mistake
when I called on Dick Rover. I should have waited until I had things
better in hand.”
“What is the next move?”
“I think we had better follow them to New York, and then you had
better find out a few more details of their plans.”
“Why don’t you do that yourself?”
“They know me, and they don’t know you.”
“They saw me out riding with you.”
“True! But I don’t think they’ll remember you. Anyway, you can
easily put on some sort of a disguise. You can bump into the boys
and pretend to get friendly and all that sort of thing,” went on the
man from the oil fields.
“All right, Davenport, I’ll do whatever you want me to,” returned the
younger man. “But understand, I’m not doing this for nothing.”
“I understand that well enough. And I’m not doing it for nothing
either. If we work this thing right there will be a small fortune in it for
all of us.”
CHAPTER XII
HOME ONCE MORE

“Here we are at last!”


It was Fred who spoke as the long train rolled into the Grand
Central Terminal, New York City, and came to a stop. The boys had
collected their hand baggage and soon the Rovers and Ruth were in
the midst of the crowd that was pouring through the gateway into the
waiting room of the big station.
“Here you are—and glad to see you!” exclaimed Dick Rover, as he
came up, followed by his wife and Fred’s mother.
There was a general handshaking and many kisses, and then Dick
Rover took possession of the young folks’ checks for their trunks and
led the way to a side street where two of the family touring cars
waited.
The trip to the metropolis had been without special incident save
for the fact that a number of the cadets, including Andy and Randy,
were inclined to indulge in more or less horseplay on the way. They
had had to make one change at the Junction, and on account of the
heavy travel had been compelled to come down in an ordinary day
coach in place of getting seats in a parlor car. They had managed,
however, to get lunch on the train and had had considerable fun
during the meal.
“I am certainly glad to see you young folks home again,” remarked
Dora Rover, as she gazed affectionately at her son and daughter
and then at the others. “And you are more than welcome, Ruth,” she
added, tapping the visitor on the shoulder.
“Maybe we’re not glad to see little old New York again!” cried Fred.
“I don’t think I’d call it ‘little old New York,’” answered Ruth, with a
smile. “To me it’s a wonderfully big and busy city. When I first arrive
here I always feel like shrinking back until I can get my bearings.”
“Oh, New York is just all right. I wouldn’t want it any better,”
answered Randy.
“But you don’t want to stay here even when you come,” put in his
Aunt Grace. “You just stay at home a few days and then away you
go on one of those trips.”
“Well, I’m a Rover by name, so why not be a rover by nature?”
was the sly reply, and this brought on a general laugh.
Soon the young folks were aboard the two automobiles. In the
meantime Dick Rover had turned the checks for the trunks over to an
expressman and in a few minutes more the whole crowd was
headed for Riverside Drive. Here a surprise awaited them. Not only
was Mrs. Tom Rover on hand to greet them, but likewise their
grandfather, Anderson Rover, and their old Aunt Martha and Uncle
Randolph, who had come from Valley Brook Farm on a short visit to
the city.
“My gracious, this is fine!” cried Fred. “A regular family reunion!”
and then came more hugs and kisses all around.
“My, my! how big you boys are getting!” said old Aunt Martha, as
she surveyed them through her spectacles. “The first thing you know,
you won’t be boys any more—you’ll be men.”
“Well, you couldn’t expect them to remain boys all their life, could
you?” queried Uncle Randolph. “Now they have graduated from
Colby Hall, I suppose they’ll either have to go to college or go into
business.”
“No use of shoving them ahead too quickly,” came from
Grandfather Rover, as he sat down and rested his chin on the top of
his cane. “They have been studying pretty hard for years—let ’em
take a rest. They might take a whole year, if it was necessary.”
“Gee, Granddad, you’re a pippin!” exclaimed Randy, going up and
placing his arm around the old man’s shoulder. “A year’s vacation
would be all to the mustard.”
“It might be if you could only get rid of some of your slang in the
meantime,” put in his mother. Yet she had to smile as she spoke.
The boys were glad to get back into their old quarters, and in the
meantime Martha escorted Ruth to the room she was to occupy
during her visit. All the connecting doors of the three houses had
been thrown wide open, making the residences virtually one. While
this was going on Dick Rover hurried back to Wall Street, for
business with The Rover Company was brisk and he was needed at
the offices.
“You must be making a lot of money, Dad,” remarked Jack, as his
parent was leaving.
“Well, we’re holding our own, Jack,” was the reply.
“How are the oil wells making out?”
“Very fine.” Dick Rover stepped closer to his son. “Did you hear
anything from Carson Davenport?” he asked in a low tone so that the
others might not hear.
“Nothing since the girls met him. They said they sent word about
that.”
“You want to be very careful, Jack. We’ll talk the whole thing over
to-night. That rascal is certainly going to put one over on us if he
possibly can.”
“Why did they let him out of prison?”
“I don’t know. He may have got a number of important friends to
appear for him before a board of pardons, or something like that.
Then again, you must remember that what he was tried for was his
trouble with his partners. I did not want to appear against him
because it would have taken too much of my time, which, just then,
was very valuable to our concern. It’s possible that he got the very
people he swindled—or tried to swindle—to sign a petition in his
favor and in favor of his other partners, Tate and Jackson. But I must
hurry now. We can talk the whole thing over later.”
During the afternoon the twins went out to renew their
acquaintance with some of their former boy chums while Jack and
Fred accompanied the girls on a sightseeing and shopping
expedition.
“I’ll be awfully sorry to leave you, Ruth,” said Jack, when he got a
chance to speak to the visitor alone.
“Well, then you’d better stay,” she answered mischievously.
“Oh, you know I couldn’t do that,” he returned hastily. “What would
the other fellows say?”
“I was only joking, Jack. You go ahead and have your outing. I
hope you enjoy every minute of it. Only, please don’t get into any
trouble,” and the girl’s face clouded.
“I think we’ll be able to take care of ourselves, Ruth. And you take
care of yourself, too.”
“Are you going to write?”
“Sure I am! And I’ll expect you to answer, too. You will, won’t you?”
“Why, of course.”
There was a brief silence, neither of them seeming to know what
to say next. Then the former major of the Colby Hall battalion
stepped closer.
“I’m going to take that photograph of you along—you know, the
one you gave me some time ago,” he said in a low tone.
“Never!” she returned quickly. “Oh, Jack, suppose—suppose the
others saw it!”
“I don’t care! I’m going to take it,” he answered firmly.
“Well, if you’re set on it, I suppose I can’t stop you,” answered
Ruth. Her eyes were shining like stars. Then Jack caught her hand
and pressed it warmly just as the others came up and interrupted
what might have proved a very interesting tête-à-tête.
Dinner that evening was a grand affair, and Ruth, who sat next to
Jack, declared she had never enjoyed anything so much in all her
life. The twins and Tom Rover were full of fun, and Tom told several
stories which convulsed everybody with laughter.
“Gee, Dad, you’re a wonder!” breathed Randy, trying to stop
laughing. “I can see where Andy gets his wit from.”
“Yes, and I know where you get your habit of playing tricks from,”
put in his mother, gazing fondly at her husband.
“Now, now! No knocking!” cried Tom gayly. “The boys are just all
right! They may cut up a little now and then, but as they both bear
marks of their mother’s good looks, that will be forgiven them,” and
then Tom dodged back, as his wife made a move as if to pull his hair.
Ruth was quite a pianist and had cultivated that talent carefully
during her days at Clearwater Hall. After dinner Dora Rover insisted
that the girl give them some music. After playing one of her best
compositions Ruth gathered all the boys and girls around her and
they sang one popular song after another.
“A touch of old times, eh?” said Dick Rover to Dora, as, with his
arm around her waist, they surveyed the scene.
“It’s history repeating itself, Dick,” she answered. And then she
looked at her husband questioningly and nodded toward where Jack
was carefully turning the sheets of music for Ruth. “What do you
think of them?” she whispered.
“I think Jack is hit pretty hard,” he returned.
“Well, Ruth seems to be an awfully nice girl, Dick.”
“I agree. I wouldn’t ask for a better girl,” he answered.
“But Jack is so young!”
“He isn’t any younger than I was when I came after you and saved
your mother from old Crabtree.”
“Oh, well, that was different!” murmured Dora.
So far the boys had had no opportunity to speak to Tom Rover
about the proposed trip to the West. But soon the twins broached the
subject, and then the crowd around the piano broke up and Mary
and Martha retired, taking Ruth with them.
“We want to talk to the boys in the library,” said Tom Rover to his
wife and his sisters-in-law, and thereupon the ladies took the hint
and also left them.
“Now, Dad, tell us all about the Rolling Thunder mine and Sunset
Trail!” cried Randy. “Gee, I wish I was out there right now!”
“And on horseback!” put in his twin. “Say, we’ll have the best times
ever!”
“I certainly hope so,” returned Dick Rover. “At the same time, I
want to caution you.”
“Don’t scare the boys into fits, Dick,” said Tom. “You’ll spoil the
whole outing if you do.”
“I’m not going to scare them into fits, Tom,” answered the older
brother. “But I am going to give them some advice that I think they
ought to have.”
“I think so too,” came from Sam Rover. “If any fellow ever got on
my nerves, it’s that rascal, Carson Davenport.”
CHAPTER XIII
A NEW ACQUAINTANCE

The mention of Carson Davenport’s name made all the boys look
serious.
“Has that fellow made another demand?” questioned Jack quickly.
“Not directly,” answered his father. “But I have heard in an indirect
way, through a detective working for one of the local agencies, that
he is watching us very carefully. He has been seen in the vicinity of
our offices several times, and you have seen him twice in the vicinity
of Colby Hall and Clearwater Hall. That’s enough for me to realize
that the scoundrel means business.”
“You forgot to mention one thing, Dick,” came from Fred’s father.
“Another one of the detectives from that agency saw Davenport in
this vicinity less than three weeks ago.”
“What do you mean? Here at the houses?” questioned Randy.
“Yes. He was out on the Drive, skulking up and down looking at all
the doors and windows. And he asked one of the tradesmen who
lived here, evidently to make sure that he had the right place.”
“Why don’t they arrest him?” questioned Andy impatiently.
“That’s what we’re going to do as soon as we can get any real
evidence against him,” answered his Uncle Dick. “I’d like to catch
him red-handed at something.”
“I’ve got a scheme!” exclaimed Randy. “Jack, you’d be the fellow
to put it through because you’re Uncle Dick’s son and it’s Uncle Dick
that Davenport is sore on.”
“What’s the idea?” questioned his cousin.
“Lay a trap for Davenport by placing yourself in such a position
that he can get at you. Then, when he thinks he’s got you, let 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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like