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
What you can do to remove data from the cache and query plans from memory for testing the performance of a query repeatedly?
Write the fastest query to find out how many rows exist in a table?
Explain about the hierarchical model of the database?
Pgm A calls Pgm B and pgm B uses cursor, when pgm B is called second time, the program is abending saying the cursor is opened? Why?
What are the key features of dbms?
What is the maximum length of an extended property?
Explain about the database management systems.
Why does this query return 0?
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?
How can you fix a poorly performing query?
Where is dbms used?
Explain the role of indexing in databases?
How would you design a database for an online site, which would average a million hits a day?
In which database can extended stored procedures be added?
Explain about query and reporting.