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

  • Home
  • SEARCH
  • 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 7524017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:58:08+00:00 2026-05-30T02:58:08+00:00

I have a table with three columns: taxon_id , scientific_name_element_id , and parent_id .

  • 0

I have a table with three columns: taxon_id, scientific_name_element_id, and parent_id. I want to find the elements that are children and not parents, so the termini of the structure.

I found some sources that suggested that I use

select taxon_id 
       from  taxon_name_element
       where taxon_id not in 
                          (select parent_id from taxon_name_element)

But this does not work, I get an empty set when I can actually browse the entries and see that there is, for example, a taxon_id=1, and NO parent_id=1

Conversely when I see what taxon_id’s are in parent_id’s I get a nonempty result set

What am I doing wrong? How can I fix this?

  • 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-30T02:58:10+00:00Added an answer on May 30, 2026 at 2:58 am

    Are there any NULLs in taxon_name_element.parent_id?

    The query…

    select taxon_id 
    from taxon_name_element
    where taxon_id not in (
        select parent_id
        from taxon_name_element
    )
    

    …is equivalent to…

    select taxon_id 
    from taxon_name_element
    where
        taxon_id <> parent_id_1
        AND taxon_id <> parent_id_2
        ...
        AND taxon_id <> parent_id_N
    

    …where parent_id_X are actual values that are currently in the parent_id column. If even one of them is NULL, the corresponding taxon_id <> parent_id_X expressions will “collapse” into NULL, dragging the whole WHERE expression with it.

    Filter-out NULLs to get what you want:

    select taxon_id 
    from taxon_name_element
    where taxon_id not in (
        select parent_id
        from taxon_name_element
        where parent_id is not null
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a (simplified) table consisting of three columns: id INT PRIMARY KEY NOT
I have a table in my data base that has three columns: Screen, Icon,
I have a table that has three different date columns, so I set each
I have a table that has three columns: Category, Timestamp and Value. What I
I have a table that has three columns: myColumn, myColumn2 and myColumn3. The three
I have a table with three NCLOB columns. For each NCLOB I want a
I have a table that contains three columns. column1 column2 column3 mytestdata test myotherdata
Assume that I have one big table with three columns: user_name, user_property, value_of_property. Lat's
Suppose that I have a table with three columns: EventID (PK) TagName TagValue I
I have a table with three columns, and two cells contain select boxes with

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.