# Why the MMDB database does not include the IP range fields?

**URL:** <https://community.ipinfo.io/t/why-the-mmdb-database-does-not-include-the-ip-range-fields/3052>\
**Category:** Database Downloads\
**Tags:** mmdb, mmdbctl\
**Created:** [September 26, 2023, 5:53pm UTC](https://community.ipinfo.io/t/why-the-mmdb-database-does-not-include-the-ip-range-fields/3052 "2023-09-26T17:53:11Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Abdullah](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.ipinfo.io/abdullah/32/4973_2.png) [@Abdullah](https://community.ipinfo.io/u/Abdullah)\
**Post date:** [September 26, 2023, 5:53pm UTC](https://community.ipinfo.io/t/why-the-mmdb-database-does-not-include-the-ip-range-fields/3052/1 "2023-09-26T17:53:11Z")

</div>

## MMDB files are designed to provide IP information in a singular direction.

 ![Why do MMDB and CSVJSON files contain different IP fields](https://canada1.discourse-cdn.com/flex035/uploads/ipinfo/original/2X/c/c4ced78cfe3470b71248c3a71526c020a66b25ed.png)

If you take a look at our MMDB files, you might notice that we do not provide the start\_ip, end\_ip and the optional join\_key fields like we do for our CSV and JSON file formats.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/ipinfo/original/2X/2/292cfde280ec4b5efb5a16b85f503d16b6f04546.jpeg)

Although we do provide the `range` field that includes the `start_ip` and `end_ip` information in the CIDR format. For example, in the example below `range` value “13.107.48.0/22” is the same as **Start IP → 13.107.48.0** and **End IP → 13.107.51.255**. The data is provided in the [CIDR range format](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing).

The `join_key` is a special IP range field that facilitates efficient IP lookups in some DBMS platforms like [Snowflake](https://app.snowflake.com/marketplace/listings/IPinfo). The `join_key` does not add value to the MMDB file format.

### Why don’t we provide those three fields?

MMDB file format is a special type of database format that is designed for one thing only — efficient IP address to IP information lookups. It can not provide support for reverse IP lookup operations such as city → IP ranges, ASN→ IP ranges etc. It is a singular path lookup file in a binary format.

The `start_ip` and `end_ip` information in the MMDB file format is essentially embedded in the binary context. When you look up an IP address using a specialized tool (like our [mmdbctl](https://github.com/ipinfo/mmdbctl) tool) that can read the MMDB binary file, input IP addresses are matched to the embedded IP range fields.

However, if you need the `start_ip` and `end_ip` information, you can still get information from the MMDB file database in the form of the `range` field (e.g. `1.188.0.0/16`)

### Is there a way to get the `start_ip` and `end_ip` information in the MMDB file?

Yes.

For that, you can download the CSV file format of the database or use the [mmdbctl](https://github.com/ipinfo/mmdbctl) tool to export the MMDB file to a CSV file ([link to documentation](https://github.com/ipinfo/mmdbctl#exporting)).

Then you compile/import the CSV database to the MMDB database with the [mmdbctl](https://github.com/ipinfo/mmdbctl)’s import command ([link to documentation](https://github.com/ipinfo/mmdbctl#importing)), like so:

```json
mmdbctl import ip_company_sample.csv ip_company_sample.mmdb

```

You will find a `network` field that combines the `start_ip` and `end_ip` values in the IP range format (e.g. `12.0.136.200-12.0.136.207`).

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/ipinfo/original/2X/f/f7e3ce03faf3c29b89b2213aceaea8c8f4d9e18e.jpeg)

If you want to keep the `start_ip` and `end_ip` columns as separate columns, duplicate the `start_ip` and `end_ip` columns in the CSV file. Rename the duplicated `start_ip` column to `start_ip_range` and `end_ip` column to `end_ip_range`.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/ipinfo/original/2X/9/938074220d533a55645fb03195317c29a88224a5.jpeg)

Then, you compile/import the CSV database to the MMDB database with the [mmdbctl](https://github.com/ipinfo/mmdbctl)’s import command ([link to documentation](https://github.com/ipinfo/mmdbctl#importing)).

```bash
mmdbctl import ip_company_sample_range.csv ip_company_sample_range.mmdb

```

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/ipinfo/original/2X/2/23f3fbb457d16a2a33822ac1d234e26e9b0d92d1.jpeg)

```bash
mmdbctl read -f json-pretty 122.54.164.0 ip_company_sample_range.mmdb

```

```json
{
  "as_domain": "pldt.com",
  "as_name": "Philippine Long Distance Telephone Company",
  "as_type": "isp",
  "asn": "AS9299",
  "country": "PH",
  "domain": "pldt.com",
  "end_ip_range": "122.54.164.7",
  "name": "IPG",
  "network": "122.54.164.0-122.54.164.7",
  "start_ip_range": "122.54.164.0",
  "type": "isp"
}

```

Even though the IP range level is not often needed for using the MMDB database, we provide the `range` field to provide context around the IP address. To further customize the MMDB database, you are always welcome to use the open source [mmdbctl](https://github.com/ipinfo/mmdbctl) tool, or you can request us to set you up with [a custom IP dataset.](https://ipinfo.io/contact)

---

_[View the full topic](https://community.ipinfo.io/t/why-the-mmdb-database-does-not-include-the-ip-range-fields/3052)._
