You're right that two airports can share the same 3-letter code, but they're not necessarily IATA codes (they could actually be FAA identifiers, or just locally assigned codes).
In implementing Otto the Autopilot in our chat room, for commands like !!weather JFK
, I needed to find a way to reliably convert IATA codes to ICAO codes. I ended up using the same source as you linked to, and imported the columns we needed into MySQL. A quick query shows 65 (i.e. >=130) duplicates:
AHT AJL API APS ARS AUS BJW CGY CLG CPO CSZ DDU DZN GIG HKG HYD IOR ISG IZA JFR JRS KFE KMM
KWB KYF LIM LUZ MCJ MCU MJF MNI MPD MPT MRE MUC NST NWT OBI OHE PCO PDG PHG PIV PPJ PRI PRM
PSV RCH REQ RZS SEA SFK STI SYC SZR TFY THO TNO TPJ UCN ULG VME VQS WRW YDT
The problem is, that IATA wants you to pay several thousand dollars for access to their list. So OurAirports attempts to collect all the known IATA codes, but it is user-editable, like Wikipedia. So there are inaccuracies in their database; and as I mentioned, there is some overlap between IATA/FAA/local.
The actual IATA codes are unique (although sometimes reused).