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
You have a table with three columns: amount1, amount2, and amount3 in a single row only one of these three columns will have a value and the other two will be null. Write a sql query to retrieve the values from these columns?
Explain the role of indexing in databases?
Explain about relational operator join?
How can I detect whether a given connection is blocked?
What is the database development process?
What are the main phases of database development?
State the acid rules?
Which four data types cannot be used as a return type from a user-defined function?
Write short notes on manual refreshes.
On friday, you issued several insert statements using query analyzer. You then verified the data had been correctly entered with a select statement on monday, your users report that the data is not there what happened?
How to generate OIDS
I have a few records all are same structures data, I want to store data in multiple targets how
Does QTP Support the Propjects which are running in Dot Net? As we are starting with new project in Dot net need to use automation tool?Please advice & let me know what would be the best.
Explain about the storage and physical database design?
Explain about post-relational databases?