What is a self join? Explain it with an example?
Answer Posted / ramya
CREATE TABLE EMPLOYEE(
[EMPLOYEE_ID] INT PRIMARY KEY,
[NAME] NVARCHAR(50),
[MANAGER_ID] INT
)
INSERT INTO EMPLOYEE VALUES(101,'Mary',102)
INSERT INTO EMPLOYEE VALUES(102,'Ravi',NULL)
INSERT INTO EMPLOYEE VALUES(103,'Raj',102)
INSERT INTO EMPLOYEE VALUES(104,'Pete',103)
INSERT INTO EMPLOYEE VALUES(105,'Prasad',103)
INSERT INTO EMPLOYEE VALUES(106,'Ben',103)
select e1.employee_id,e1.name,e1.manager_id,e2.name from
employee e1 join employee e2
on e1.employee_id = e2.manager_id
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How can you log an error to the server event log from a stored procedure?
I HAVE A PI ON COL A THE NEXT DAY I WANT CHANGE THE PI ON COL B? PLS SEND ME THE ANS
What are the 18 schemas?
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?
Write short notes on manual refreshes.
What is normalization? Explain different levels of normalization?
What are the three types of database design?
How is data stored in dbms?
In which table collections errors are stored.
What are the key features of dbms?
What are the main phases of database development?
Explain the role of indexing in databases?
Any sample or model question of punjab national bank for deputy manger IT or any sample of PNB.any1 plz do send on
Explain about post-relational databases?
How you can make a parameterized view?