What is a self join? Explain it with an example?
Answer Posted / kannan
CREATE TABLE IF NOT EXISTS `emp` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) collate latin1_general_ci NOT NULL,
`dept_id` int(11) NOT NULL,
`mgr_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
)
SELECT e2.name Employee_name, e1.name Manager_name
FROM emp e1, emp e2
WHERE e2.mgr_id = e1.id
| Is This Answer Correct ? | 12 Yes | 8 No |
Post New Answer View All Answers
What is DB Development software?
I have a few records all are same structures data, I want to store data in multiple targets how
What is a database development?
Explain about xml databases?
Explain about relational database management systems?
You have two tables with a one to many join based on a field named id. You need to find records in the parent table that are not represented in the child table. how would you accomplish this?
Who are end users in dbms?
Explain about the hierarchical model of the database?
How can you fix a poorly performing query?
If a column is an image value type, how you can compare column values? How can you use this column in join clause?
What is dbms and its application?
To convert IDMS to DB2, how to deal with IDMS occurs and redefined clause?
Write short notes on manual refreshes.
Explain about the database management systems.
Explain the role of indexing in databases?