What is a self join? Explain it with an example?
Answer Posted / krishna prasad a
For this Answer 1 is incorrect.
CREATE TABLE candytest
(kidId char(2),
candycolor varchar(10)
)
GO
INSERT INTO candytest SELECT 'K1', 'Yellow'
INSERT INTO candytest SELECT 'K1', 'Red'
INSERT INTO candytest SELECT 'K2', 'Red'
INSERT INTO candytest SELECT 'K2', 'Blue'
INSERT INTO candytest SELECT 'K3', 'White'
INSERT INTO candytest SELECT 'K3', 'Red'
INSERT INTO candytest SELECT 'K3', 'Yellow'
Go
--Now to find those kidid's which has both yellow and red
colored candies, we can write query as:
Select c1.candytest from
candytest c1,candytest c2
where c1.candycolor=c2.candycolor
and c1.kidid=c2.kidid
| Is This Answer Correct ? | 20 Yes | 13 No |
Post New Answer View All Answers
Explain about the hierarchical model of the database?
What is dbms and its application?
Can an extended stored procedure be called from inside a user-defined function?
How is data stored in dbms?
What are the three basic rules which are to be followed for the relational model of the database?
How to combine two function together?
Where is dbms used?
How to replace not in with not exist?
How to generate OIDS
What are data modelling techniques?
Hi my program is accesing data from two db2 databases.what is the bind card for this program to genarate plan? how to specify the two owners and two qualifiers in bind card
What are the key features of dbms?
Write the fastest query to find out how many rows exist in a table?
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).
Write short notes on manual refreshes.