SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


T SQL


T SQL

Author
Message
myates7
myates7
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3389 Visits: 169
The problem is that the order by clause was left out on the initail page.

Today's Question:


What is the output for the query below?

CREATE TABLE E (eid int, mid int, en char(10) )
INSERT E SELECT 1,2,'Vyas'
INSERT E SELECT 2,3,'Mohan'
INSERT E SELECT 3,NULL,'Shobha'
INSERT E SELECT 4,2,'Shridhar'
INSERT E SELECT 5,2,'Sourabh'
SELECT t1.en [Em], t2.en [Ma] FROM E t1, E t2 WHERE t1.mid = t2.eid

when you click the "Click Here" the question has an additional line with the order by clasue

CREATE TABLE E (eid int, mid int, en char(10) )
INSERT E SELECT 1,2,'Vyas'
INSERT E SELECT 2,3,'Mohan'
INSERT E SELECT 3,NULL,'Shobha'
INSERT E SELECT 4,2,'Shridhar'
INSERT E SELECT 5,2,'Sourabh'


SELECT t1.en [Em], t2.en [Ma] FROM E t1, E t2 WHERE t1.mid = t2.eid

order by t1.en
Steve Jones
Steve Jones
SSC Guru
SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)SSC Guru (61K reputation)

Group: Administrators
Points: 61839 Visits: 19099
The question was edited to include an ORDER BY. Questions get edited if mistakes are found.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
VM-723206
VM-723206
Right there with Babe
Right there with Babe (758 reputation)Right there with Babe (758 reputation)Right there with Babe (758 reputation)Right there with Babe (758 reputation)Right there with Babe (758 reputation)Right there with Babe (758 reputation)Right there with Babe (758 reputation)Right there with Babe (758 reputation)

Group: General Forum Members
Points: 758 Visits: 267
easy one! option 1 is the only answer that satisfies the ORDER BY!
Neal-564363
Neal-564363
SSC Rookie
SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)SSC Rookie (42 reputation)

Group: General Forum Members
Points: 42 Visits: 28
Was the typo intentional? I know Attention to detail is important for the DBA - but intentional typo's are bad form.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search