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 8879585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:58:53+00:00 2026-06-14T19:58:53+00:00

I am just getting to know NATURAL JOIN and SQLite is not behaning as

  • 0

I am just getting to know NATURAL JOIN and SQLite is not behaning as I expect.

SELECT * FROM r1 NATURAL JOIN (r2 NATURAL JOIN r3);

and

SELECT * FROM (r1 NATURAL JOIN r2) NATURAL JOIN r3;

produce the same (correct) results.

However if I omit the parentheses as in:

SELECT * FROM r1 NATURAL JOIN r2 NATURAL JOIN r3;

I see that r1 and r2 are joined correctly however r3 is not joined to the result at all, instead the cartesian product of r1 NATURAL JOIN r2, r3 is formed.

Is there an issue with the attribute names of the first join result, or am I misinterpreting SQL?

  • 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-06-14T19:58:55+00:00Added an answer on June 14, 2026 at 7:58 pm

    I don’t use that database myself, but according to this documentation, all joins in SQLite are based on the cartesian product of the left and right tables.

    NATURAL joins use common column names as “keys” to combined two tables. Using parentheses forces a “derived table” to be built before the outer join is processed. Without parentheses, it does not “see” the common column names, so the second NATURAL keyword is ignored.

    A little advice: it’s good to understand the mechanics of how a NATURAL JOIN works in case you ever see it in code, but do not use it yourself. It is a “dangerous” construct with little value. Just my opinion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to SQLite so I don't know what I'm doing wrong. I'm just getting
Just getting started with db2. Quick question about giving it SQL commands from a
I am just getting to know numpy, and I am impressed by its claims
This is my first post, so I'm just getting to know how the community
I'm just getting myself to familiarize with GIS but i like to know before
I am just getting started with C++ and wanted to know does it really
I'm just getting to know some of the new .NET concurrent collections like ConcurrentDictionary
I'm just getting started with NService bus and I want to know how to
I am building a mobile site with asp.net mvc3 and just getting to know
I'm just getting into event-driven architectures and would like to know what the convention

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.