Professional Documents
Culture Documents
(Download PDF) Mysql Crash Course 2Nd Edition Forta Online Ebook All Chapter PDF
(Download PDF) Mysql Crash Course 2Nd Edition Forta Online Ebook All Chapter PDF
https://textbookfull.com/product/ap-chemistry-crash-course-2nd-
edition-adrian-dingle/
https://textbookfull.com/product/electrochemistry-crash-course-
for-engineers-slobodan-petrovic/
https://textbookfull.com/product/excel-crash-course-for-
engineers-eklas-hossain/
https://textbookfull.com/product/python-crash-course-a-hands-on-
project-based-introduction-to-programming-2nd-edition-eric-
matthes/
C Crash Course A Fast Paced Introduction Josh Lospinoso
https://textbookfull.com/product/c-crash-course-a-fast-paced-
introduction-josh-lospinoso/
https://textbookfull.com/product/paramedic-crash-course-with-
online-practice-test-1st-edition-christopher-coughlin-ph-d/
https://textbookfull.com/product/memory-crash-2nd-edition-
georgiy-kasianov/
https://textbookfull.com/product/ruby-beginner-s-crash-course-
ruby-for-beginners-guide-to-ruby-programming-ruby-on-rails-rails-
programming-2nd-edition-quick-start-guides/
https://textbookfull.com/product/crash-course-for-the-gre-your-
last-minute-guide-to-scoring-high-6th-edition-coll/
MySQL Crash
Course
This page intentionally left blank
MySQL Crash
Course
Second Edition
Ben Forta
Many of the designations used by manufacturers and sellers to distinguish their Vice President, IT Professional
products are claimed as trademarks. Where those designations appear in this book, and Mark Taub
the publisher was aware of a trademark claim, the designations have been printed with
initial capital letters or in all capitals. Acquisitions Editor
Kim Spenceley
The author and publisher have taken care in the preparation of this book, but make
no expressed or implied warranty of any kind and assume no responsibility for errors Development Editor
or omissions. No liability is assumed for incidental or consequential damages in Chris Zahn
connection with or arising out of the use of the information or programs contained
herein.
Managing Editor
Sandra Schroeder
For information about buying this title in bulk quantities, or for special sales
opportunities (which may include electronic versions; custom cover designs; and
content particular to your business, training goals, marketing focus, or branding Senior Project Editor
interests), please contact our corporate sales department at corpsales@pearsoned.com Tonya Simpson
or (800) 382-3419.
Copy Editor
For government sales inquiries, please contact governmentsales@pearsoned.com. Kitty Wilson
For questions about sales outside the U.S., please contact intlcs@pearson.com. Indexer
Timothy Wright
Visit us on the Web: informit.com/aw
Proofreader
Library of Congress Control Number: 2023943569 Jennifer Hinchliffe
ISBN-13: 978-0-13-822302-1
ISBN-10: 0-13-822302-5
$PrintCode
Pearson’s Commitment to Diversity, Equity, and Inclusion
Pearson is dedicated to creating bias-free content that reflects the diversity of all learners.
We embrace the many dimensions of diversity, including but not limited to race, ethnicity,
gender, socioeconomic status, ability, age, sexual orientation, and religious or political beliefs.
Education is a powerful force for equity and change in our world. It has the poten-
tial to deliver opportunities that improve lives and enable economic mobility. As we
work with authors to create content for every product and service, we acknowledge
our responsibility to demonstrate inclusivity and incorporate diverse scholarship so that
everyone can achieve their potential through learning. As the world’s leading learning
company, we have a duty to help drive change and live up to our purpose to help more
people create a better life for themselves and to create a better world.
Our ambition is to purposefully contribute to a world where
Q Everyone has an equitable and lifelong opportunity to succeed through learning
Q Our educational products and services are inclusive and represent the rich diversity
of learners
Q Our educational content accurately reflects the histories and experiences of the
learners we serve
Q Our educational content prompts deeper discussions with learners and motivates
them to expand their own learning (and worldview)
While we work hard to present unbiased content, we want to hear from you about
any concerns or needs with this Pearson product so that we can investigate and address
them.
Please contact us with concerns about any potential bias at
https://www.pearson.com/report-bias.html.
This page intentionally left blank
Contents
1 Understanding SQL 1
Database Basics 1
What Is a Database? 2
Tables 2
Columns and Datatypes 3
Rows 4
Primary Keys 4
What Is SQL? 6
Try It Yourself 6
Summary 7
2 Introducing MySQL 9
What Is MySQL? 9
Client/Server Software 9
MySQL Versions 10
MySQL Tools 11
mysql Command-Line Utility 11
MySQL Workbench 12
Other Tools 13
Summary 13
4 Retrieving Data 25
The SELECT Statement 25
Retrieving Individual Columns 25
viii Contents
6 Filtering Data 43
Using the WHERE Clause 43
WHERE Clause Operators 44
Checking Against a Single Value 45
Checking for Nonmatches 46
Checking for a Range of Values 47
Checking for No Value 48
Summary 49
Challenges 49
12 Summarizing Data 93
Using Aggregate Functions 93
The Avg() Function 94
The Count() Function 95
The Max() Function 96
The Min() Function 97
The Sum() Function 98
Aggregates on Distinct Values 99
Combining Aggregate Functions 100
Summary 101
Challenges 101
Index 265
This page intentionally left blank
4 Chapter 1 Understanding SQL
Columns that contain dates, text, notes, currency amounts, and so on would use the
appropriate datatypes.
New Term
Datatype A type of allowed data. Every table column has an associated datatype that
restricts (or allows) specific data in that column.
Datatypes restrict the type of data that can be stored in a column (for example,
preventing the entry of alphabetical characters into a numeric field). Datatypes also help
sort data correctly and play an important role in optimizing disk usage. As such, special
attention must be given to picking the right datatype when tables are created.
Rows
Data in a table is stored in rows; each record saved is stored in its own row. Again, if you
envision a table as a spreadsheet-style grid, the vertical columns in the grid are the table
columns, and the horizontal rows are the table rows.
For example, a customers table might store one customer per row. The number of
rows in the table is the number of records in the table.
New Term
Row A record in a table.
Note
Records or Rows? You might hear users refer to database records when referring to
rows. For the most part, the two terms are used interchangeably, but row is technically the
correct term.
Primary Keys
Every row in a table should have some column (or set of columns) that uniquely
identifies it. A table containing customers might use a customer number column for
this purpose, whereas a table containing orders might use the order ID. Similarly, an
employee list table might use an employee ID column.
New Term
Primary Key A column (or set of columns) whose values uniquely identify every row
in a table.
Another random document with
no related content on Scribd:
firing, a pool of molten iron is formed by the thermit, which is very
penetrating and affords a good combustible surface for the oil, which
burns for an additional ten minutes.
It has an advantage over the Mark I dart in that it penetrates, and
over the Mark II bomb in that it is smaller and lighter in weight.
Incendiary Shell
Incendiary Bullets
Special projectiles were designed for use with the Stokes mortar
and the Livens’ projector. Thermit was used only in Stokes’
projectiles. The Livens’ projectile was filled with inflammable units
(chlorated jute) immersed in a light oil mixture. Thrown from a
projector into the enemy’s trench, it explodes, giving a large flash
and scattering the burning units over an area of forty yards. The
Mark II projectile, designed for general incendiary effect against
readily inflammable material, consists of an altered 8-inch Livens’
gas projectile filled with chlorated jute units impregnated with solid oil
and immersed in a spontaneously inflammable oil. After a short
delay, these units burst into flame and burn vigorously for several
minutes. It is almost impossible to extinguish them without large
quantities of water. Such bombs have only a very limited use, so that
it is questionable if they are really worth while.
Fig. 111.—German 8"
Incendiary Bullet.
Fig. 112.—German Incendiary
Blue Pencil.
Flaming Gun
Among the unsuccessful weapons of the late war, the liquid fire
gun or Flammenwerfer, as the German called it, is probably the most
interesting. Its origin, according to a German story, was due to a
mere accident. A certain officer, during peace maneuvers, was
ordered to hold a fort at all cost. During the sham fight, having
employed all the means at his disposal, he finally called out the fire
brigade and directed streams of water upon the attacking force.
Afterwards, during the criticism of the operations in the presence of
the Kaiser, he claimed that he had subjected the attackers to
streams of burning oil. The Kaiser immediately inquired whether
such a thing would be possible, and was assured that it was entirely
feasible.
The fact that the trenches were often very close together during
the early part of the war, made possible the use of large or stationary
Flammenwerfer. These consisted of a steel reservoir 3⅓ feet in
height and 1⅔ feet in diameter, weighing about 250 pounds, which
could be connected to two steel cylinders, containing nitrogen under
pressure. These carried 180 liters (40 gallons) of liquid and operated
under a pressure of 15 atmospheres. The discharge nozzle was at
the end of a metal tube three feet long, and its orifice was about ⁵/₁₆
of an inch in diameter. The range of this apparatus was from 33 to 40
yards and the duration of the flame from one to two minutes.
Because of the comparatively short range of these guns and the
ease with which they could be destroyed, if located by the enemy,
their use was very limited.
Even with the portable flammenwerfer, the most difficult thing to
do is to get near enough the target to make the shoot effective.
Another serious disadvantage is its very short duration. It is
impossible to charge up again on the spot, and the result is that once
the flame stops, the whole game is finished and the operators are at
the mercy of the enemy.
With these facts in mind it is easy to see how service in the
flaming gun regiments is apparently a form of punishment. Men
convicted of offenses in other regiments were transferred either for a
time or permanently and were forced under threat of death in the
most hazardous enterprises and to carry out the most dangerous
work. Taken all in all the flame thrower was one of the greatest
failures among the many promising devices tried out on a large scale
in the war.
CHAPTER XXI
THE PHARMACOLOGY OF WAR GASES
The pharmacology of war gases plays such an important part in chemical warfare that
a brief discussion may well be given of the methods used in the testing of gases for
toxicity and other pharmacological properties.
War gases may be divided into two groups: persistent and non-persistent, each of
which may include several classes:
I. Lethal
II. Lachrymatory
III. Sternutatory
IV. Special
Each class necessitates special tests in order to determine whether or not it is suitable
for further development.
Toxicity
One of the first points which must be carefully determined in investigating a substance
is its toxicity. It is important that this be determined for numerous reasons:
1. To determine what concentrations are dangerous in the field.
2. To ascertain how effective protective devices have to be to furnish sufficient
protection against the gas.
3. To furnish a basis for accurate experimental work on the treatment of gassed cases.
4. To decide whether or not the material is worthy of further development in the
laboratory or in the plant.
These considerations necessitate the determination of the toxicity in the form of a
vapor and not by the ordinary method of administration by mouth, through the skin
(subcutaneously) or through the blood (intravenously). The simplest method of
determining the toxicity of a substance as a vapor would be to place animals in a gas-tight
box and introduce a known amount of the substance in the form of vapor. But by this
method the concentration is not accurately known unless chemical analyses of the air are
made, and then it is found to be much less than that calculated from the amount of
substance introduced, because of condensation on the walls of the chamber, or
absorption of the substance by the skin and hair of the animal and in some cases, of
decomposition of the substance by moisture in the air. Moreover, it is found that the
concentration decreases markedly with time. Because of these factors, the figures used
for the concentration are more or less guess work. To overcome these difficulties, a
chamber is used through which a continuous current of air, containing a known and
constant amount of the poisonous vapor, is passed. Such an apparatus is shown in Fig.
116.
The flask E is a 300 cc. Erlenmeyer flask, with a ground glass stopper. The liquid to be
tested is placed in this flask together with a sufficient quantity of glass wool to prevent
splashing and the carrying over mechanically of droplets of the liquid. Air is passed
through A and C (calcium chloride drying tubes) and the rate measured by the flow meter
D. The air and gas are mixed in F before passing into the chamber G. This chamber is
made of plate glass, is of about 100 liters capacity, and is air-tight. The entire flow of air
and gas through the box, kept constant at 250 liters per minute, is measured at H. The
gas is removed through K, which is filled with charcoal and soda-lime, in order that little
gas may pass into the pump.
By weighing the flask E, and its contents before and after passing air through it, and
knowing the total volume of the mixture passing through the chamber during the same
period, the concentration of the substance can readily be calculated. This concentration,
as determined by the “loss in weight” method, can be checked by chemical analysis
(samples taken at M—M). The method has been found to give accurate values.
The concentration in the chamber reaches its constant level within 30 to 40 seconds
after the apparatus is started.
With the flow of 250 liters per minute, the difficulties mentioned above are reduced to a
point where they are practically negligible.
All toxicity tests on mice were made with an exposure of ten minutes, while dogs were
exposed for thirty minutes. In case death did not occur during exposure, the animals were
kept under observation for several days. Toxicity and all other figures are expressed in
milligrams per liter of air, though parts per million (p.p.m.) was frequently used during the
early work.
Another point of difficulty is the great individual variation in the susceptibility of
animals. This is probably greater than when the poison is administered subcutaneously or
intravenously. It necessitates the use of a large number of animals in making a
determination of the toxicity of a gas. Again, the toxicity for different species may vary,
and as the ultimate aim is a knowledge of the toxicity for man, a great many different
species must be used. If the toxicity is widely different for different animal species, it is
hard to arrive at a definite conclusion as to the toxicity for man.
With longer exposures than thirty minutes the lethal concentration is usually less, there
being a cumulative effect. This is not true for hydrocyanic acid. If the concentration is not
enough to kill at once, an animal can stand it almost indefinitely. Whether the action is
cumulative or not depends on the rate at which the system destroys or eliminates the
poison. If the poison is being eliminated as fast as received the concentration in the
tissues cannot increase. It is stated, for example, that the amount of nicotine in a cigar
would kill a man if taken in one dose. If it is spread over twenty minutes, the destruction or
elimination of the nicotine is so rapid that no obviously bad effects are noted.
Another interesting thing about the work on poison gases is that in most cases a
preliminary exposure to less than the lethal concentration does not seem to make the
animal either more or less sensitive on a later exposure. This is quite unexpected,
because we know that with irritating gases, especially lachrymators, men adapt
themselves to much higher concentrations than they could stand at first. In view of the
experiences of arsenic eaters, it is quite possible that the experiments, which showed no
accustoming to toxic gases, were not continued long enough to give positive results.
Not only does the susceptibility of different animals of the same species vary greatly
for a particular gas, but the susceptibility of different species varies greatly with different
gases. Thus while the effects of certain gases on mice are quite comparable to the effects
on man, it is very far from being true with other gases.
Lachrymators
While one cannot determine the lethal concentrations of poison gases for men, it is
possible to determine the concentration that will produce lachrymation. The threshold
value is that at which two-thirds of the observers experience irritation. The lachrymatory
value is considerably higher than the threshold value.
Fig. 117.—Aeration Apparatus for Testing Lachrymators.
A very satisfactory method for determining lachrymatory values is shown in Fig. 117.
Air is measured at A and bubbled through the lachrymatory substance in B. The air and
gas are mixed in D and pass into E, a gas-tight, glass-walled chamber of about 150 liters
capacity. The gas is removed through Ef, by suction and the volume of the air-gas mixture
measured by the flow meter, F.
After the apparatus has run a few minutes, and the concentration of the gas has
become constant, the subject is instructed to adjust the mask, attached at H, and to tell
whatever he notices just as soon as he notices it. The operator stands in such a position
that he can manipulate the stopcock H without being observed by the subject. After
breathing air for a time (H is a two-way cock, connected with the air through J, and to the
chamber through Eg) both to become accustomed to the mask and to eliminate, as far as
possible, any “psychological symptoms,” the subject is allowed to breathe the gas mixture
for a maximum of three minutes. If the expected symptoms are produced in less than this
time, the test is discontinued as soon as they develop.
Fig. 118.—Type of Spray Nozzles.
For accurate work, it is necessary to work with a pure sample which is at least fairly
volatile. Mixtures cannot be run by this method. In this case it is necessary to volatilize
each separately, passing the vapors simultaneously into the mixing chamber E.
A spray method may also be used with satisfactory results. Types of sprays are shown
in Fig. 118.
Odors
Because of the great value in detecting low concentrations of gases in the field, it is
important to know the smallest amount of a gas that can be detected by odor. In some
cases, this test is more delicate than any chemical test yet devised.
Odors may be divided into two classes, true odors, and mild irritation. By true odor is
meant a definite stimulation of the olfactory nerve, giving rise to a sensation which is more
or less characteristic for each substance producing the stimulation. Mild irritation defines
the sensation which is confused with the sense of smell by untrained observers, but which
is really a gentle stimulation of the sensory nerve endings of the nose. This so-called odor
of substances producing this effect is not characteristic. Higher concentrations of these
compounds almost invariably cause a definite irritation of the nose.
Examples of true odors are the mercaptans, mustard gas, bromoacetone, acrolein,
chlorine and ammonia. Substances which cause mild irritation are chloroacetone, methyl
dichloroarsine, ethyl iodoacetate and chloropicrin.
In making the test for odor, the same apparatus is used as for lachrymators. The time
of exposure is shortened to 30 seconds, as the subject always detects the odor at the first
or second inhalation.
In this connection the recent work of Allison and Katz (J. Ind. Eng. Chem. 11, 336,
[1919]) is of interest. They have designed an instrument, “the odorometer,” for measuring
the intensity of odors in varying concentrations in air. It is based on the principle given
above. A measured volume of air is passed through the liquid and then diluted to a given
concentration. The mixture is then passed through a rubber tube with a glass funnel at the
open end. Only one inhalation of the mixture is used to determine the intensity of the odor.
The position of any strength of odor on the scale depends upon the sensitiveness and
judgment of the operator, but with one person conducting the entire test, the results have
been found quite satisfactory. (See tables on pages 360 and 361.)
Skin Irritants
Substances which seem useful for producing skin burns are studied both on animals
and on man. Dichloroethyl sulfide (mustard gas) is used as a basis of comparison.
Several methods are available.
Direct Application. This method consists of the direct application of the compound
itself to the skin, using a definite quantity (0.005 cc. or 0.005 mg.) over a definite area (5
square centimeters) of the skin. With such a quantity of mustard gas a rather severe burn
on animals is produced. No precautions are taken to prevent evaporation from the skin
since it is believed that in this way the test will approximate fairly closely the field
conditions.
Vapor Tests. Preliminary tests with vapors of volatile compounds are best made by
placing a small amount of the material on a plug of cotton in the bottom of a test tube
enclosed in a larger test tube which acts as an air jacket. After about an hour at room
temperature the mouth of the test tube is applied to the skin. The concentration is not
known, but one is dealing practically with saturated vapor. If an exposure of from 30 to 60
minutes produces no effect, one is safe to assume that the compound is not sufficiently
active to be of value as a skin irritant.
If quantitative results are desired, the apparatus shown in Fig. 119 is used. Dry air is
blown through the bubbler, which is connected with a series of glass skin applicators. The
concentration is determined in the usual way. The skin applicator consists of a small
cylinder about 1.5 to 2 cm. in diameter and about 4 cm. long with a small glass handle
attached on top. The opening is 1 cm. in diameter. When the concentration of the gas is
constant, the exposure to the skin is made directly for any desired length of time. The skin
irritant efficiency is judged by comparing the per cent of positive responses to
approximately equal concentrations of the vapors, using mustard gas as a standard.