Jump to content
Larry Ullman's Book Forums

Recommended Posts

Chapter 3 of the 3rd Edition of this book includes some work with a database of US zipcodes borrowed from US census bureau or some similar organization. The database is located here (the smaller database):




Some of the latitude and longitude values in the database are empty, which can be checked by running the following query:


SELECT * FROM zip_codes WHERE latitude='';


Which outputs a number of results.


(Showing rows 0 - 29 (648 total, Query took 0.0042 sec))


Larry offers to replace the empty values with NULL, by running this query:


UPDATE zip_codes SET latitude=NULL, longitude=NULL WHERE latitude='';


But nothing happens!


(0 row(s) affected. ( Query took 0.0993 sec ))


Is there an error in the UPDATE query? What am I missing, why does it fail to update?


Would be grateful for your help, as always!

Share this post

Link to post
Share on other sites

Most likely, you haven't made the latitude and longitude values "nullable" in the DB.

In other words, you need to set the columns in the DB so that a NULL value can be set in the first place.

Please verify that.

  • Upvote 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...