Handbook
CSV File Format
Last updated by sandeep on Sat, 07/19/2003 - 17:23
The CSV file contains four fields:
This is a sample of how the CSV file is structured:
You can import this data into any database by creating a table with the following fields:
You can query the above table, after you have imported the data into it, to find the country of a corresponding IP Number by issuing the following Select statement:
- Begining of IP address range
- Ending of IP address range
- Two-character country code based on ISO 3166
- Three-character country code based on ISO 3166
- Country name based on ISO 3166
This is a sample of how the CSV file is structured:
"0033996344","0033996351","GB","GBR","UNITED KINGDOM" "0050331648","0083886079","US","USA","UNITED STATES" "0094585424","0094585439","SE","SWE","SWEDEN" ...Note: All IP addresses are represented as IP Numbers which is the numeric representation of the dotted IP address.
You can import this data into any database by creating a table with the following fields:
| FIELD | DATA TYPE | FIELD DESCRIPTION |
| IP_FROM | NUMERICAL (DOUBLE) | Beginning of IP address range. |
| IP_TO | NUMERICAL (DOUBLE) | Ending of IP address range. |
| COUNTRY_CODE2 | CHAR(2) | Two-character country code based on ISO 3166. |
| COUNTRY_CODE3 | CHAR(3) | Three-character country code based on ISO 3166. |
| COUNTRY_NAME | VARCHAR(50) | Country name based on ISO 3166 |
You can query the above table, after you have imported the data into it, to find the country of a corresponding IP Number by issuing the following Select statement:
SELECT COUNTRY_NAME FROM <TableName> WHERE IP_FROM <= IP Number and IP_TO >= IP Number
