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 is normalization? Explain different levels of normalization?
Explain the rollup operator?
How is data stored in dbms?
What are the constraints on severity level in raiseerror?
Explain about the database management systems.
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 detail about ftp in datastage?
fact table and dimension table containg one to many relationship or many to one relastionship
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?
If a column is an image value type, how you can compare column values? How can you use this column in join clause?
When installing the datastage7.5x2 edtion iam getting aproblem i.e the cpu count is 2 but the cpu count in installation is one . how can i install in my p.c (system is dual core).
Explain about the storage and physical database design?
What are the key features of dbms?
Explain about query and reporting.
Explain about a primary key?