Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.51 KB | None | 0 0
  1. mysql> show create table geoip\G                                                            *************************** 1. row ***************************
  2.        Table: geoip
  3. Create Table: CREATE TABLE `geoip` (
  4.   `ipfrom` varchar(15) default NULL,
  5.   `ipto` varchar(15) default NULL,
  6.   `ipf` int(10) unsigned default NULL,
  7.   `ipt` int(10) unsigned default NULL,
  8.   `ccode` char(3) default NULL,
  9.   KEY `ipf` (`ipf`,`ipt`)
  10. ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  11. 1 row in set (0.00 sec)
  12.  
  13. mysql> select * from geoip where 1479868930 >= ipf and 1479868930 <= ipt;                   +-----------+---------------+------------+------------+-------+
  14. | ipfrom    | ipto          | ipf        | ipt        | ccode |
  15. +-----------+---------------+------------+------------+-------+
  16. | 88.32.0.0 | 88.63.255.255 | 1478492160 | 1480589311 | IT    |
  17. +-----------+---------------+------------+------------+-------+
  18. 1 row in set (0.39 sec)
  19.  
  20. mysql> select G.* from geoip G JOIN geoip X ON G.ipf=X.ipf where 1479868930 >= G.ipf and 1479868930 <= X.ipt;
  21. +-----------+---------------+------------+------------+-------+
  22. | ipfrom    | ipto          | ipf        | ipt        | ccode |
  23. +-----------+---------------+------------+------------+-------+
  24. | 88.32.0.0 | 88.63.255.255 | 1478492160 | 1480589311 | IT    |
  25. +-----------+---------------+------------+------------+-------+
  26. 1 row in set (0.08 sec)
  27.  
  28. mysql> select count(*) from geoip;
  29. +----------+
  30. | count(*) |
  31. +----------+
  32. |   140246 |
  33. +----------+
  34. 1 row in set (0.00 sec)
  35.  
  36. mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement