Errata

Getting Started with SQL

Errata for Getting Started with SQL

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Chapter 6, section Aggregate Functions

from Getting Started with SQL
safaribooksonline.com/a/getting-started-with/12358733/


Chapter 6, section Aggregate Functions

1st Finding
It seems to be a typo with AVG(temp) - consider using AVG(temperature) instead.
For example,
SELECT month,AVG(temperature) AS avg_temp FROM station_data WHERE year >= 2000 GROUP BY month;

2nd Finding
It seems to be a typo with round(AVG(temp),2) - consider using round(AVG(temperature),2) instead.

For example,
SELECT month, round(AVG(temperature),2) as avg_temp FROM station_data WHERE year >= 2000 GROUP BY month

Vladimir Epifanov  Feb 12, 2018  Aug 25, 2023
Printed
Page PAGE 34
FIRST EXAMPLE CODE

The book states that the first example with "true" and "false" instead of 0 and 1 should not work, however it does indeed work. Either SQLite has changed or SQLite Studio is doing the translation.

Note from the Author or Editor:
SQlite has changed to support the use of true/false since the book was published. We can change the text so this is now reflected.

EVAN DUFFEY  Sep 23, 2022  Aug 25, 2023
PDF
Page 25
2

the general note :

When giving names to anything in SQL (whether it is an alias, a
column name, a table name, or any other entity), always use an
underscore ( _ ) as a placeholder for spaces. You will run into errors otherwise.

and the example above it , in the sql code and the figure 4-7
you can see that in the sql code

PRICE AS UNTAXED_PRICE,
PRICE * 1.07 AS TAXED_PRICE

the using of underscore here as place holder for space in UNTAXED_PRICE and TAXED_PRICE

and the result in the figure 4-7 show that the columns header replace the underscore with space !!!

and this is not right because if i put underscore in the column name it will be show as underscore not replace with space and the way to put space in the name of the column is to put it inside double quotations like this "UNTAXED PRICE" not replace the space with underscore .

i think this point need more clarification

Note from the Author or Editor:
Change “You will run into errors otherwise.” into “It is best practice.” I also think the reader is pointing out a bug with SQLiteStudio at the time as well, and we need to replace Figure 4-7.

karimkoko  Aug 31, 2016  Aug 25, 2023
PDF
Page 26
code snippt above Figure 4-8

The code snippt's execution result is not consistent with Figure 4-8.

"PRICE," should actually be "PRICE AS UNTAXED_PRICE"

Note from the Author or Editor:
Sure, we can change the SQL code so it used “PRICE AS UNTAXED_PRICE” rather than just “PRICE.”

Jiang Peng  Aug 15, 2016  Aug 25, 2023
Printed, PDF
Page 43
First paragraph

Let’s move on to other aggregation tasks. If you wanted to find the average temperature
for each month since 2000, you could filter for years 2000 and later, group by
month, and perform an average on temp (Figure 6-4):
SELECT month, AVG(temp) as avg_temp
FROM station_data
WHERE year >= 2000
GROUP BY month

In the above paragraph on page 43 and SQL query, the column name should be "temperature" instead of "temp".

Note from the Author or Editor:
That is correct. It should be temperature.

Satishchandra Singh  Mar 06, 2016  Aug 25, 2023
Printed,
Page 62
sql code

page 62 on the SQL code part while running the code as it is printed now SQLite3 will throw an error saying "ambiguous column PRODUCT_ID"

in the SQL code example (line 10) if instead of PRODUCT_ID, I update as PRODUCT.PRODUCT_ID solves the issue and gives the same results as in figure 8.11 (page 63)

alex susanu  Apr 03, 2020  Aug 25, 2023
Printed
Page 63
1st paragraph, SQL query

PRODUCT_ID is an ambiguous column name, needs to be qualified e.g. as PRODUCT.PRODUCT_ID.

Anonymous  Jul 29, 2016  Aug 25, 2023
Printed
Page 73
Figure 9-2

page 73 the database layout looks like/refers to:

COMPANY
- primary_contact_attendee_id

On page 93 you refer to:

INSERT INTO COMPANY (NAME, DESCRIPTION, PRIMARY_CONTACT_ID) VALUES ('RexApp Solutions', 'A mobile app delivery service', 5)

The example database proves to be right. If you build it yourself though, you come up with the error that it doesn’t exist.

Anonymous  Apr 19, 2016  Aug 25, 2023
Printed
Page 84
3rd paragraph in "Setting the Foreign Keys"

Set the foreign table to CUSTOMER and the foreign column to CUSTOMER_ID. This will constrain BOOKED_COMPANY_ID to only the values in the CUSTOMER_ID column in the CUSTOMER table. Click Apply, then OK.”

Should be:

Set the foreign table to COMPANY and the foreign column to COMPANY_ID. This will constrain BOOKED_COMPANY_ID to only the values in the COMPANY_ID column in the COMPANY table. Click Apply, then OK.”

Anonymous  Apr 19, 2016  Aug 25, 2023
Printed, Other Digital Version
Page 84
3rd paragraph

On the paragraph starting:

"Set the foreign table to CUSTOMER and the foreign column to CUSTOMER_ID. This will constrain BOOKED_COMPANY_ID to only the values in the CUSTOMER_ID column in the CUSTOMER table. Click Apply, then OK.”

COMPANY and COMPANY_ID respectively instead of CUSTOMER / CUSTOMER_ID

alex susanu  Apr 03, 2020  Aug 25, 2023
PDF
Page 88
bottom

The following query should use SEATS instead of SEAT_CAPACITY in the WHERE condition.

(wrong)
SELECT * FROM PRESENTATION_VW
WHERE SEAT_CAPACITY >= 30

(right)
SELECT * FROM PRESENTATION_VW
WHERE SEATS >= 30




Prashant Chegoor  Jun 21, 2016  Aug 25, 2023
PDF
Page 94
Just before DELETE

The book says:

INSERT INTO COMPANY (NAME, DESCRIPTION, PRIMARY_CONTACT_ID)

But this produces an error: "table COMPANY has no column named PRIMARY_CONTACT_ID".

Shouldn't it instead be:

INSERT INTO COMPANY (NAME, DESCRIPTION, PRIMARY_CONTACT_ATTENDEE_ID)

Note from the Author or Editor:
Yes, PRIMARY_CONTACT_ID needs to be PRIMARY_CONTACT_ATTENDEE_ID across all instances in this chapter.

Anonymous  Feb 06, 2018  Aug 25, 2023
Other Digital Version
1328
Kindle version, Chapt 9 figure 9-13 and following code example.

PRIMARY_CONTACT_ID should be PRIMARY_CONTACT_ATTENDEE_ID.

Randy Pierson  Oct 31, 2018  Aug 23, 2023
Printed, PDF, Mobi,
Page 1679 (Kindle)
Appendix A5

One of the examples I put in Appendix A5 is incorrect.

"state like 'D_l%'" should actually be "city like 'D_l%'"

Thomas Nield
Thomas Nield
 
Mar 06, 2016  Aug 25, 2023