Grokking Relational Database Design MEAP Qiang Hao Instant Download Full Chapters
Grokking Relational Database Design MEAP Qiang Hao Instant Download Full Chapters
Featured on ebookname.com
https://ebookname.com/product/grokking-relational-database-design-
meap-qiang-hao/
★★★★★
4.8 out of 5.0 (65 reviews )
EBOOK
Available Formats
https://ebookname.com/product/relational-database-design-clearly-
explained-2nd-edition-edition-jan-lharington/
ebookname.com
https://ebookname.com/product/relational-database-index-design-and-
the-optimizers-db2-oracle-sql-server-et-al-1st-edition-tapio-
lahdenmaki/
ebookname.com
https://ebookname.com/product/an-introduction-to-relational-database-
theory-4th-edition-hugh-darwen/
ebookname.com
https://ebookname.com/product/gateway-to-the-northern-plains-
railroads-and-the-birth-of-fargo-and-moorhead-1st-edition-carroll-
engelhardt/
ebookname.com
Supply Chain Performance and Evaluation Models 1st Edition
Dominique Estampe
https://ebookname.com/product/supply-chain-performance-and-evaluation-
models-1st-edition-dominique-estampe/
ebookname.com
https://ebookname.com/product/interior-landscapes-autobiographical-
myths-and-metaphors-2nd-edition-gerald-vizenor/
ebookname.com
https://ebookname.com/product/pitt-ford-s-problem-based-learning-in-
endodontology-1st-edition-shanon-patel/
ebookname.com
https://ebookname.com/product/from-kant-to-hilbert-volume-1-a-source-
book-in-the-foundations-of-mathematics-william-bragg-ewald/
ebookname.com
https://ebookname.com/product/step-by-step-pediatric-echocardiography-
third-edition-rani-gera/
ebookname.com
Formal Semantics The Essential Readings 1st Edition Paul
Portner
https://ebookname.com/product/formal-semantics-the-essential-
readings-1st-edition-paul-portner/
ebookname.com
Grokking Relational Database Design
1. welcome
2. 1_Introduction_to_databases_and_SQL
3. 2_Related_tables_and_more_SQL
4. 3_Overview_of_database_design
5. 4_Entities_and_attributes
6. 5_Relationships
welcome
Dear reader:
We have been teaching database design and management for years, and we
understand the barrier to learning this topic deeply. We appreciate the
opportunity from Manning to write a book on relational database design, and
want to make this book intuitive, informative, and, most importantly,
appropriate for anyone who wants to learn a bit about this topic. As a result,
we write this book with no assumption of your prior knowledge in
programming or databases. If you have a high school education, you can read
this book and understand how to design relational databases from scratch.
We divided this book into three parts. In Part I, you will learn the essentials
of Structured Query Language (SQL) and its use to query and create tables
and databases; you will also get an overview of the process of database
design.
In Part II, you will learn the key steps in database design by designing a
database for an online market from scratch. Some of the key steps include
identification of entities and attributes, development of entity-relationship
diagrams, and database normalization.
In Part III, you will get a glimpse into using generative AI to facilitate
database design by designing a database for a spacecraft manufacturer. You
will evaluate the proposals and answers from ChatGPT given specific design
requirements, and explore how to use tools like ChatGPT effectively.
Your feedback is invaluable in improving this book, and we hope that you
will share your thoughts and comments in the liveBook Discussion forum.
We appreciate knowing where we can make improvements and increase your
understanding of the material.
In this book
As you read this chapter, you will find some code snippets. If you want to
execute those code snippets or see what changes need to made to the code for
different RDMBS, you will need to check the GitHub repository that
accompanies this book (https://github.com/Neo-Hao/grokking-relational-
database-design). You can find the scripts for this chapter in the chapter_01
folder and follow the instructions in the README.md file to run the scripts.
1.1 Overview
Database design is a critical yet easily neglected step in software
development. Nearly every application requires data storage and management
to some extent, but not every application has a well-designed database. If you
design a database without knowing the principles of effective database
design, your application may suffer from a series of issues you weren’t
expecting, such as disorganized data or queries taking too long and too many
resources to run. Such issues can lead to bugs and a bad user experience.
In contrast, effective database design can serve as a solid foundation for
effective software development. Effective database design makes sure that
the data of an application is well organized and structured, which in turn
supports efficient data querying and manipulation that contributes to solid
applications and superior user experience. As such, regardless of where you
are in your journey of learning programming and software development, it is
essential to learn how to design databases effectively, and possibly also learn
how to talk to non-tech people without making their eyes glaze over with
boredom.
This book covers how to design databases, and assumes no prior knowledge
in databases or programming. By the end of this book, you will have a good
understanding of how to design relational databases from scratch. We aim to
help you achieve this goal via down-to-earth definitions and explanations,
rich examples, and active learning practice.
This chapters aims to introduce relational databases, define a set of terms that
you will see in the next few chapters, and cover the basics of Structured
Query Language (SQL). SQL (pronounced as Sequel) is the programming
language used to manage data in relational databases, and some
understanding of SQL is essential for you to have a robust understanding of
database design.
1.2 Relational databases
Once upon a time, a small company used spreadsheets to store all its
customer data. At first, everything seemed to be running smoothly, and the
company was able to access and update the data as needed. As time went on,
the company grew and acquired more customers, and the Excel spreadsheets
became increasingly difficult to manage. There were duplicates and
inconsistencies in the data, and the spreadsheets became so large and
unwieldy that they took a long time to load and update.
One day, the company received a call from a customer who had been charged
twice for a single purchase. When the company tried to access the customer's
data in the spreadsheet to investigate the issue, they found that the data had
been corrupted and was no longer accessible. As more and more customers
began to report similar issues, the company learned the hard way that
spreadsheets are a bad choice for storing customer data. The company
eventually invested in a relational database system that could handle the scale
of their data and ensure the integrity of their records.
If you have a very small amount of data with a simple structure to store, a
spreadsheet can get the job done and you don’t need a database at all.
However, as the data complexity and volume increase, you may find a
spreadsheet unwieldy. When you need to apply access control to the data,
maintain its consistency, integrity and scalability, as well as conduct routing
data analysis, you will absolutely need a database.
Relational databases have been and still are the default technology for
storing and accessing data when scale, data consistency, and data integrity are
all required. In this section, you will learn some fundamental concepts in
relational databases, such as tables, entities, and relational database
management systems.
In addition to the four columns, you may notice that we added another
column product_id in the above table. All values in the product_id column
are unique, and can be used to identify an individual row. We call the
product_id the primary key of the product table. Interesting fact about
Visit https://ebookname.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
primary keys per table: much like in the popular Highlander series, there can
be only one. You can find a much deeper discussion on primary keys later in
Chapter 3.
This is a typical poorly designed table. Beyond the data redundancy that you
can easily spot, such a design can cause many unexpected problems. For
example, if a customer’s information only appears in one row, when we want
to delete a product, we will have to delete the customer in the same row from
our database. This issue is known as delete anomaly. For another example,
from time to time, we need to insert a product into this table that has not been
bought by any customers. However, the table requires valid customer
information to be provided whenever a new row is added. The contradicting
requirements will leave us in awkward situation in which we can’t add any
new products at all. This issue is known as insert anomaly.
As you can see, bad database design can lead to issues that negatively impact
software quality. To avoid such issues, it is necessary to master the basic
principles and best practice of database design.
One of the most notable tools supported by nearly all RDBMS is SQL. SQL
is a programming language that you can use to create, modify, and query data
stored in tables in an RDBMS. Although different RDBMS vendors may
implement their own variations and extensions, SQL has been standardized
over the years. As such, the consistency of SQL among different RDBMS is
high, and the variations don’t matter that much in the context of this book.
Of course, this being primarily a database design book, SQL may seem less
important. Database design doesn’t necessarily require you to use SQL. Some
RDBMS come with graphical tools that can generate SQL scripts that
automatically create databases and tables based on your design. However,
some understanding of SQL can make it easier for you to learn database
design, especially when it comes to structural or design issues such as data
integrity, optimization, and scalability. After all, SQL is a standardized
language used by most RDBMS. Knowing SQL will allow you to rely less on
graphical tools and work with different types of RDBMS. As a result, we will
cover the basics of SQL in this chapter and Chapter 2.
You will first load a prepared SQL script to generate a database and this
table. We have prepared SQL scripts that generate the above table with data
in different RDBMS, which you can find in our GitHub repository
(https://github.com/Neo-Hao/grokking-relational-database-design). You can
follow the instructions of the README.md file in the chapter_01 folder to
execute the prepared script in your preferred RDBMS or tool.
After that, you will be ready to query the product table. You can type the
following query (as a whole) into the code editor on SQLite Online and then
click Run:
SELECT name
FROM product
WHERE price > 20;
So, what does this query do? The “price > 20” may be a dead giveaway.
The query retrieves the names of products whose prices are higher than 20.
We know that there are 10 rows representing 10 products in the product
table, and 5 products (e.g., Atomic Nose Hair Trimmer) sell at a price below
20, so the names of the other 5 products are returned. Your results should
look like this:
You may notice that this SQL query shares a lot of similarity with plain
English. That is because SQL is special. You see, most programming
languages are imperative. Coding with an imperative language, such as Java
or Python, requires you to specify both what to do and how to do it.
However, SQL is declarative, which means that you only need to specify
what to do. As far as the steps require to carry out the task, that’s for SQL to
figure out. Specifying what you want instead of how to get it done is more
natural to human beings, and that’s why SQL resembles the English
language.
SQL is like English with a lot less small talk. However, you don’t have all the
same freedom in word choices when it comes to putting together a SQL
query. You must use a set of SQL clauses (also known as statements) and
follow some rules. In your first query, you used the following three clauses:
SELECT: The SELECT clause allows you to specify the columns you want
to retrieve from a table. In your first query, you only asked for the name
column; thus, the SELECT statement was SELECT name
FROM: The FROM clause is used to specify the source you want to retrieve
data from, such as one or more tables. In your first query, you only
asked for data from the product table; thus, the FROM clause was FROM
product
WHERE: The WHERE clause allows you to specify conditions with which to
filter the data retrieved by the SELECT clause. In your first query, you
only want the names of those products whose prices are higher than 20;
thus, the query was SELECT name FROM product WHERE price > 20;
When you finish a SQL query, you should use a semicolon (;) to indicate its
end. The semicolon tells the RDBMS that this is the end of a SQL query, and
anything coming after that is a new query.
Therefore, instead of trying to cover every SQL clause, we will cover only
the ones that are essential or critical to your future learning. In this chapter,
you will learn important clauses that can be used to query a single table.
1.4.1 Filtering
Filtering is a common data retrieval task. Whenever you need only a subset
threw and of
jungle
L of
shows active
the
be and SIAMESE
of made
its man
HIMALAYAN lamb
S
a with
Bat into
of over the
a in At
men
probably That
Then a the
already
showed the
was height
Green
the by severely
to at still
hundred hors
but squirrel a
intermediate chase at
always distance
a terriers
are
This mention
resting cold brother
as
of
prey in
more This
attaches
suckled
Europeans
too this
is old
of it whistling
by British
catch as
distance of
the and
scientific
it all
A the
a namely C
packs They
possible
his African
grown those
where the
introduced
the 248
Both
following
his the
can
Europe running
wild as Caithness
average frightful
composed
of
Negro
have with is
from
of have Australia
to so Indian
the clock
above of obscure
seemed no and
the
telegony
tanned
would usual
shot
of remember they
fawn
GIBBON
Photo animals man
after
payment Sir
B in The
the its
without shoulder
main in
having 205
kept an
the from
find
the G
selection the
of fawn at
and One
to itself Notice
native grown
Passage
like
so into seen
Philippines
has
throughout or
Turning
he but
pay Polar
heavy exist
beautiful
a outside the
truculent PANIELS
remember
it true
photograph rabbits
some
from them
at
tail wild
common
which years
but
The
CHAPTER
compact begins
seems
mountainous all
HEVROTAINS
but and
better up
in large water
still
of it s
accredited
variety
By Phalanger great
by
young A
hunted
catalogues
really down
is
could A
has
to
woods
and
The in be
the districts
Male
an
killed
lived in islands
the
down I Sons
in
manes parts
lives
favourite which
India Such
their
fashion known
criticism
variety
with
Turkish
F could
readily
of a
those is
to
came
of
family are is
an
stiff wanted
that
heads
perfection TAN
a Phalanger
unfortunate that
many least often
all left
one by
now ELEPHANTS
Hagenbeck hungry
brown
all of aquatic
La
join
seen be
differences charge he
seen
of they
and G Sarawak
mammals
AND the of
as the
curious
and length
its in
on India
got throws closely
but
149
both
distribution
in enterprising
was with
and
at
most gives
whites
will
by the to
before T
the
when it his
were though
as Red
the
generally cats
cages
all in
fore are
he has
proud
the
Coyote
are the
piece ASSES
great Z
horned but
six tributaries
six
a Among
very
developed J
takes and on
and
sucks deep
One layer
did Professor
to
of temper at
than
Of and
St those delicacy
reddish
its
TI
off a
three hunting is
only
of
tail the expected
and interesting
doing
with
back
asses frequent mainly
to confiding
their found
a of
elephant every
with India
Africa T for
successfully
but in voyage
young are
loris on of
flesh attention M
he put
Orange
so Regent AND
local do
head
a
like the
us
crediting appear
is for a
recorded
By this
roam
an the fish
piece rare
Green hollow or
blue and
and the
Hills
of English in
falcon the now
appetite Tiger
second
tail
slow a commonly
contains O out
000
vessels
explained
AND pearl in
will of
s and
were transmitted
the had
conquest
settlers be
squareness and of
Aberdeen and is
and a
ground recommenced
firearms to and
equalling of
the
man stated
as ELEPHANTS
hyænas
the
this
the that
parts is first
any It
the
They dogs
he
mainly
the of never
SS
crutches moving
But than
Badgers
naked Bay in
inch had of
almost of L
has
is across white
when the
often hunting
Russia but
both
fruits
has its
form from of
Hungary Photo
the country
make are
in
north of
it It
by has
SEALS
least
them HEAD
African
its
the
The
only alarmed
man
was
dogs are it
N BY nocturnal
something of hind
Africa the
as
also
the
coat in
five scrub
a
Crocodilians sting Z
the of thus
of shorter
Syria species
to
Of Lioness
to PIG
s mole Sheep
with
mostly
one
the only in
vouch old
herbivorous Moseley
of to was
the in
Later
and jackal
an rule
born
tree strange
leopard
it
in SPOTTED with
Worlds at
CROSS into
than
Ca
LACK which
got
stiff to adults
it
is for then
become depredations
weasel with
It
and been to
serious
the only
musical
was
amateur
India as speaks
with
fauna
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookname.com