database sql server 的免费国家、城市数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/621350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 07:12:39  来源:igfitidea点击:

free country, city database for sql server

databaseip-geolocationcountrycity

提问by StoneHeart

have anyone used this before, i need free country, city, IP database for sqlserver

以前有没有人用过这个,我需要免费的国家、城市、sqlserver 的 IP 数据库

采纳答案by Donny Kurnia

ipinfodbprovide free geolocation data for MySQL. With a simple database translator, you can put it into different database, since the table structure is simple. They also provide data in CSV format, that will be easier to imported to different database engine.

ipinfodb为 MySQL 提供免费的地理定位数据。使用简单的数据库转换器,您可以将其放入不同的数据库中,因为表结构很简单。它们还提供 CSV 格式的数据,这将更容易导入到不同的数据库引擎。

The data is based on free version of MaxMind, and it's updated every month. They also provide free API, if you don't want to store the data in your server. The accuracy is decent and enough for normal website usage.

数据基于免费版MaxMind,每月更新一次。如果您不想将数据存储在服务器中,他们还提供免费的 API。准确性不错,足以满足正常的网站使用。

回答by Nathan Voxland

I have used http://www.maxmind.com/app/geolitecity. It is a less exact version of their paid database. The free database claims to be "over 99.5% on a country level and 79% on a city level for the US within a 25 mile radius". You can see their accuracy detailed at http://www.maxmind.com/app/geolite_city_accuracy.

我使用过http://www.maxmind.com/app/geolitecity。这是他们付费数据库的不太准确的版本。该免费数据库声称“在 25 英里半径范围内,美国的国家级超过 99.5%,城市级超过 79%”。您可以在http://www.maxmind.com/app/geolite_city_accuracy 上查看详细信息

The data is presented as a CSV file containing the starting IP block, ending IP block, and the location. It is easy enough to load into sqlserver.

数据显示为 CSV 文件,其中包含起始 IP 块、结束 IP 块和位置。加载到 sqlserver 中很容易。

APIs in C, C#, PHP, Java, Perl and the free version, GeoLite, has an IPv6 version in addition to the downloadable CSV Format.

除了可下载的 CSV 格式之外,C、C#、PHP、Java、Perl 和免费版本 GeoLite 中的 API 还具有 IPv6 版本。

回答by Chris Fulstow

If you need to find the location of the current user based on their IP address, then you could try the Google Geolocation API, in particular google.loader.ClientLocation.

如果您需要根据当前用户的 IP 地址查找当前用户的位置,那么您可以尝试使用 Google Geolocation API,尤其是google.loader.ClientLocation.

Check out the Google API docs for more info: http://code.google.com/apis/ajax/documentation/#ClientLocation

查看 Google API 文档了解更多信息:http: //code.google.com/apis/ajax/documentation/#ClientLocation

回答by Sudhir

Check this free world cities database http://www.sudostuff.com/world-cities-database-8.html

检查这个免费的世界城市数据库http://www.sudostuff.com/world-cities-database-8.html

Includes city, region and country.

包括城市、地区和国家。

MySQL format file to download with three tables, country, region and City. Country schema

MySQL 格式文件下载,包含三个表,国家、地区和城市。 国家模式

CREATE TABLE IF NOT EXISTS `country` (
`countryId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` VARCHAR(5) DEFAULT NULL,
`name` VARCHAR(150) DEFAULT NULL,
PRIMARY KEY (`countryId`)
) ENGINE=InnoDB;

INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(1, 'ad', 'andorra');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(2, 'ae', 'united arab emirates');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(3, 'af', 'afghanistan');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(4, 'ag', 'antigua and barbuda');
INSERT INTO `country` (`countryId`, `code`, `name`) VALUES(5, 'ai', 'anguilla');

回答by Baraskar Sandeep

You can find the Mysql Database from here too...

您也可以从这里找到 Mysql 数据库...

https://github.com/baraskar/Worlds-Country-State-and-City-Mysql-Database

https://github.com/baraskar/Worlds-Country-State-and-City-Mysql-Database

Suggestions always welcome...

随时欢迎提出建议...

回答by Tural Ali

Not exactly for SQL Server but for MySQL, I suggest, you to checkout this GitHub repository:

不完全适用于 SQL Server,而是适用于 MySQL,我建议您查看此 GitHub 存储库:

https://github.com/turalus/openDB

https://github.com/turalus/openDB

回答by Ganesh S

Geonames is free data but lots and lots of data. You need a DBA to cleanup the data. But it is one time effort to clean the load the data as per your requirement. I ended up with a 1.3 GB file size after zip extraction and loading this data to DB also requires a good powerful hardware.

Geonames 是免费数据,但数据量很大。您需要一个 DBA 来清理数据。但是根据您的要求清理加载数据是一次努力。zip 解压缩后我最终得到了 1.3 GB 的文件大小,并将这些数据加载到 DB 也需要一个强大的硬件。

maxmind data is very old and they have stopped updating the free data that the provide

maxmind 数据很旧,他们已经停止更新提供的免费数据

Then there are many paid data sources but listing the least costly and good one that I used sometime back world cities database from http://www.worldcitiesdatabase.comwhich is at reasonable cost.

然后有许多付费数据源,但列出了我曾经使用过的成本最低且性能良好的数据源,该数据源来自http://www.worldcitiesdatabase.com 的世界城市数据库,成本合理。

Then you can look at maxmind paid data services as well but they are very costly unless your budget is very good.

然后您也可以查看 maxmind 付费数据服务,但除非您的预算非常好,否则它们非常昂贵。

Hope this helps.

希望这可以帮助。

回答by Yanni

回答by user2253362

See database here -

在此处查看数据库 -

http://myip.ms/info/cities_sql_database/World_Cities_SQL_Mysql_Database.html

http://myip.ms/info/cities_sql_database/World_Cities_SQL_Mysql_Database.html

They have countries / cities ddatabase for Microsoft Sql Server. Here code -

他们有 Microsoft Sql Server 的国家/城市 ddatabase。这里的代码 -

CREATE TABLE countries (
  countryID varchar(3) NOT NULL,
  countryName varchar(52) NOT NULL,
  localName varchar(45) NOT NULL,
  webCode varchar(2) NOT NULL,
  region varchar(26) NOT NULL,
  continent varchar(15) NOT NULL,
  latitude float NOT NULL,
  longitude float NOT NULL,
  surfaceArea float NOT NULL,
  population int NOT NULL,
  PRIMARY KEY (countryID),
  UNIQUE (webCode),
  UNIQUE (countryName)
);


CREATE TABLE cities (
  cityID int NOT NULL,
  cityName varchar(50) NOT NULL,
  stateID int NOT NULL,
  countryID varchar(3) NOT NULL,
  latitude float NOT NULL,
  longitude float NOT NULL,
  PRIMARY KEY (cityID),
  UNIQUE (countryID,stateID,cityID)
);