Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6736663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:09:24+00:00 2026-05-26T11:09:24+00:00

I’m working with an application that has the following tables for storing IP address

  • 0

I’m working with an application that has the following tables for storing IP address ranges:

IP_RANGE
--------
RANGE_ID      primary key
NETWORK_ID    foreign key into NETWORK table (not described here)
IP_ID         foreign key into IP_ADDRESS table
RANGE_TYPE    varchar, values "START" or "END"

IP_ADDRESS
----
IP_ID         primary key
IP_NETWORK    number (decimal representation of network portion of address)
IP_INTERFACE  number (decimal representation of interface portion of address)

A given IP address range is represented by two rows in the IP_RANGE table: one with a RANGE_TYPE value of “START” and another with a value of “END”, both of which have the same value for NETWORK_ID. Each of these rows also point to a row in the IP_ADDRESS table which stores the actual addresses.

I need to write a SELECT statement that gives me all of the NETWORK_IDs which have IP ranges that have any addresses in common with a given arbitrary IP range.

I know how to inspect the IP_ADDRESS table to find individual addresses that fall inside or outside my desired range, but I don’t know how to restrict my search to only begin/end pairs that have the same NETWORK_ID.

(I suppose this is really a pure SQL question rather than anything specifically to do with IP addresses.)

Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 – 64bit Production

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:09:25+00:00Added an answer on May 26, 2026 at 11:09 am

    You need to join IP_RANGE to itself to get information about both the range-start and the range-end with a single query. You also need to join each occurrence of IP_RANGE to IP_ADDRESS in order to do your IP-address comparisons; so, all told, you’ll have something like this:

    SELECT ip_range_start.network_id
      FROM ip_range ip_range_start
      JOIN ip_address ip_range_start_address
        ON ip_range_start.ip_id = ip_range_start_address.ip_id
      JOIN ip_range ip_range_end
        ON ip_range_start.network_id = ip_range_end.network_id
      JOIN ip_address ip_range_end_address
        ON ip_range_end.ip_id = ip_range_end_address.ip_id
     WHERE ip_range_start.range_type = 'START'
       AND ip_range_end.range_type = 'END'
       AND (    ... -- ip_range_start_address less than or equal to end of desired IP range
             OR ... -- ip_range_end_address greater than or equal to start of desired IP range
           )
    ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.