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 relational database management systems?
How to use online Backups?
What are the main phases of database development?
Hi , any one can help me on the same,this is regarding the Informatica Function doc,i want to know how developer is will develop the mapping. pl forwar the any function doc .just for my references. svlc75@yahoo.co.in
Explain about query and reporting.
How to combine two function together?
The count() function always returns a int value type what should you do if you need to count rows from a query which you know will return a value that is too large for an int value type?
Explain about the storage and physical database design?
What are the types of database model?
What is an application role and explain a scenario when you would use one?
Explain about normal forms?
What is the maximum length of an extended property?
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?
Write short notes on manual refreshes.
How to use timestamp datatypes