Sam's notebook

Loading spatial data into MySQL with LOAD DATA INFILE July 23rd, 2015, 9AM

Programming

Just a note for my future reference: importing an Excel CSV into MySQL. The WKT column has been constructed by hand to be POINT(lng lat) and the CSV contains headers. LOAD DATA INFILE ‘/full_path/to/file-on-server.csv’ REPLACE INTO TABLE the_table COLUMNS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”‘ IGNORE 1 ROWS (name,description,@geographic_location) SET geographic_location = GeomFromText(@geographic_location) ;

[No comments] [Keywords: , , , , , , , , ] [Permanent link]

Finding all date ranges (which may be open-ended) that overlap with a given range May 17th, 2011, 11AM

Programming

Given a database table listing events and their date ranges: events { id, start_date, end_date, … }, where either or both of the dates can be null, how is one to find all of the events that fall within (even partially) a given date range? (This is pretty much what Kieran Benton asked on Stack […]

[No comments] [Keywords: , , , , , , , ] [Permanent link]