What is a self join? Explain it with an example?
Answer Posted / anuj barthwal
A self join applies on one table only
Example:
emp_id emp_name emp_manager_id
1 Anuj NULL
2 Sunny 1
3 Suraj 1
4 Narban 2
if we want to get the name of the managers
select e1.emp_name 'manager',e2.emp_name 'employee'
from employees e1 join employees e2
on e1.emp_id=e2.emp_manager_id
manager employee
Anuj Sunny
Anuj Suraj
Sunny Narban
Self join means joining the single table to itself
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
How long can an error message be in raiseerror function?
What are data modelling techniques?
Can an extended stored procedure be called from inside a user-defined function?
What is the maximum length of an extended property?
How to generate OIDS
Write short notes on manual refreshes.
How you can make a parameterized view?
1. Using the XML Document below, with the URI “recipe.xml”
define
the following queries in XQuery:
a.) Give the names of all breakfast in the menu.
b.) Select breakfasts that have price lower than $7.00?
Explain about the database management systems.
What is data modeling with example?
Explain about normal forms?
You are testing the performance of a query the first time you run the query, the performance is slow. the second time you run the query, the performance is fast. why is this?
Explain about the hierarchical model of the database?
Explain about xml databases?
What is the physical representation for a many-to-many relationship?