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
What is the maximum length of an extended property?
How can I detect whether a given connection is blocked?
What are the constraints on severity level in raiseerror?
Explain about post-relational databases?
What you can do to remove data from the cache and query plans from memory for testing the performance of a query repeatedly?
Can an extended stored procedure be called from inside a user-defined function?
On friday, you issued several insert statements using query analyzer. You then verified the data had been correctly entered with a select statement on monday, your users report that the data is not there what happened?
How to read and create .LDC data files which are used by linguatic dictionary.
Write the fastest query to find out how many rows exist in a table?
How to use timestamp datatypes
Does QTP Support the Propjects which are running in Dot Net? As we are starting with new project in Dot net need to use automation tool?Please advice & let me know what would be the best.
Explain about query and reporting.
Explain about the database management systems.
What is data modeling with example?
Explain about a primary key?