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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:48:09+00:00 2026-06-15T09:48:09+00:00

I repeat a student question here. I’ve given some sort of explanation, but hoping

  • 0

I repeat a student question here. I’ve given some sort of explanation, but hoping you have better, clearer ones.

A self-join is done with two aliases for the table:

SELECT parent.Name, child.Name
FROM Person parent
INNER JOIN Person child ON parent.Id = child.ParentId

But that just sounds like we’re making things complicated. So:

(1) Are the aliases really needed? Why?

(2) It’s possible, technically, to use just one alias. Why are all the examples, online, textbooks, tutorials, always using two aliases?

  • 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-15T09:48:10+00:00Added an answer on June 15, 2026 at 9:48 am

    1) Yes, you have to have at least one alias. Otherwise, how do you know which table-version is which?

    2) You could just use one alias. Two are not strictly necessary. Using two aliases will almost always be clearer than one alias though.

    Which is easier to understand at a glance?

    SELECT parent.Name, child.Name
    FROM Person parent
    INNER JOIN Person child ON parent.Id = child.ParentId
    

    Or

    SELECT Person.Name, child.Name
    FROM Person
    INNER JOIN Person child ON Person.Id = child.ParentId
    

    The first one shows intent a lot better.


    By the way, you’d probably want to alias the columns as well. While two columns having the same name in a result is fine, it might be confusing, and if you tried to put result rows into some kind of associative container in the client code, it would break. So a better still version of the query, for example, would be:

    SELECT parent.Name ParentName, child.Name ChildName
    FROM Person parent
    INNER JOIN Person child ON parent.Id = child.ParentId
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a repeat control that list some documents. I would like to
Sorry to repeat old questions, but I didn't quite understand the answer. The question
This could be a repeat question, I apologize. I have a jsp page in
I want to repeat this question using python. Reason is I have access to
Hoping this isnt a repeat question as I could not find an answer. I
Quick question on Bitmap repeat x and y, i tried the following and it
I have a simple 'repeat with' in an AppleScript, and would like to move
This may be a repeat of the following unanswered question: Help with bitmap lock
So I have this code in python that writes some values to a Dictionary
Initial Question: A group of us (electronic engineering students - UK) have recently been

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.