what is self join

SELECT
    e.first_name + ' ' + e.last_name employee,
    m.first_name + ' ' + m.last_name manager
FROM
    sales.staffs e
INNER JOIN sales.staffs m ON m.staff_id = e.manager_id
ORDER BY
    manager;

4.4
5
Masay 115 points

                                    SELECT column_name(s)
FROM table1 T1, table1 T2
WHERE condition;

4.4 (5 Votes)
0
4
2
John_d0e 105 points

                                    Self is joining a table to itself.

-- assume employee table as 2 different table using different alias 
-- as  manager and worker 
-- we want to join these 2 virtual manager and worker table 
-- to get manager's first name and worker's first name 
-- our condition is worker's manager_id match managers employee id

SELECT  manager.FIRST_NAME AS MANAGER_NAME , 
        worker.FIRST_NAME AS WORKER_NAME 
FROM EMPLOYEES manager 
INNER JOIN EMPLOYEES worker on worker.MANAGER_ID = manager.EMPLOYEE_ID  

order by 1 
;

4 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
Self join explained Self joins. self joinn SELF OUTER JOIN self -join sql self -join why do we use self join 2) What is a self-join and how is it used? how to create self join why do we use self join in sql when we use self join in sql self.join self joins what's the self join when we can use self join self joining what is self join used for… example? what is the use of self join self join use how to self join when to use a self join when are self joins used use of self join when to use self join why self join is used where is self join used What is a self join? Explain it with an example. <> in self join self join query join self self join uses what does self join self join in sql waht it does when is self join used? example to self join self-join sql what is self join used for when we use self join self join Baq self-join.sql example where to use self join when to use self joins when use self join where we use self join in sql how to write self join in sql self join\ self join example in sql server self-join 1:1 example what is use of self join how to use self join in sql how to self join table in sql join same table sql self join with normal join sql sql join within same table sql join table to same table how to join a table with itself join a table from sql query with itself join query with itself join sql table to self sql join table to self join the same table sql query for self join in sql server sql perform join with same table selft join in sql server Explain self join in DBMS. join table to itself sql sql auto join Auto / Self Joins self join example in sql self join syntax define self join relation in t sql self join in t sql sql inner join to self how to join a table to itself in sql table self join self join tsql self table query what is a self join sql self join with same table self join in sql server with example table join on itself join table on its self select self join self hoin mysql aelf join sql how to join a table with itself sql is on required for self join self join sel self inner join in sql with indexes and explain function what is the self join sql query self join example inner join on same table insert value in sql from select self join query mysql self inner join bootstrap self join mysql php mysql self join how self join works in sql with html select example how self join works in sql with example join on the same table sql self joun sql inner join same table can do inner join on yhe same table? innner self join query to join table to itself sql self join where clause SELF JOIN one result join with the same table self join for customers in the same city what is self join with example whywe useselfjoin in sql self jion sql server self join example self join in dbms self join examle select operation on same table in sql self referencing sql query sql self joins explained sql self joins with examples join table with itself sql Self joins auto join sql practice sql self join sql join to same table sql single table join self table reference in sql mysql self join min self join min mysql selj join in sql self join in sql with example self join sql to check one column sql join table to itself example of a SELF JOIN? self join table sql join itself sql join it self join in sql with tahe same table A Self JOIN is when self join example in mysql sql self join queries how to join 1 tables in sql why we use self join in sql how to self join php mysql self join query in mysql sql from same tables autojoin function mysql select self join self join a table sql SELF join in different databases join from same table sql JOIN SELF SQL sql server self join Which of the query in SQL is an example of self-join? I. SELECT a.column_name FROM table1 a, table1 b WHERE a.x = b.x; II. SELECT b.column_name FROM table1 a, table2 b WHERE a.y = b.y; sql recursive w3schools self join sql examples self join w3schools self joins in dbms sql join table with itself how to use self join in mysql sql server self join syntax explain self join with example sql join from same table self referential sql sql join on 1 table self join query in sql self join in sql example sql query on same table mysql join where a.city = b.city why sef join sql self outer join in sql when to use a self join sql what is a self join in sql self join sql example sql join on self What is a self Join sql join query to itself sql join in the same table sql query self join self join code sql join on same table how to apply selef join mysql self join self join mysql self-joins sql sql join same table what is self join wpractical applications of self join in sql when to use self join in sql mysql selfjoin self join practical example sql self join hierarchical data self join in mysql self join sql query self join examples sql self join examples what is self join in sql self inner join in sql example of self join self join sql what is the use of self join in sql create table with self join in sql sql self join example self join what is it example use of self join in sql sql self join self join in sql server self join sql with example self join self join in sql self join sql server self join example
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source