Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
Reg: Interview Questions
12 posts, Page 1 of 2
1
2
»»
Reg: Interview Questions
Rate Topic
Display Mode
Topic Options
Author
Message
vs.satheesh
vs.satheesh
Posted Tuesday, November 06, 2012 4:59 PM
Valued Member
Group: General Forum Members
Last Login: Today @ 12:09 AM
Points: 54,
Visits: 309
I face one interview question.One salary table i have three column like (id,name,salary)
Table Name:SalaryDetail
id name salary
1 arun 1000
2 jothi 2000
3 kavi 3000
4 rahul 4000
5 jeeva 5000
In this above i want following result
id name salary Salry2
1 arun 1000 null
2 jothi 2000 1000
3 kavi 3000 2000
4 rahul 4000 3000
5 jeeva 5000 4000.
Please reply this .
Post #1381751
GilaMonster
GilaMonster
Posted Tuesday, November 06, 2012 5:01 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 1:13 AM
Points: 38,103,
Visits: 30,394
So, what do you have so far?
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #1381752
CELKO
CELKO
Posted Tuesday, November 06, 2012 6:13 PM
SSCommitted
Group: General Forum Members
Last Login: Tuesday, January 15, 2013 11:11 AM
Points: 1,945,
Visits: 2,782
>> I face one interview question. One salary table I have three columns like (id,name,salary) <<
Now we have to track down this interview so we can tell them that you cheat. I have gotten two students and one lecturer kicked out of their schools for this kind of academic dishonesty.
Oh, you forgot the DDL that is minimal Netiquette.
CREATE TABLE Salary_Details
(emp_id INTEGER NOT NULL PRIMARY KEY,
emp_name VARCHAR(25) NOT NULL,
salary_amt DECIMAL (8,2) NOT NULL
CHECK ( salary_amt >= 0.00) );
>> In this above I want following result <<
What is the business rule for the computation?
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Post #1381762
Kingston Dhasian
Kingston Dhasian
Posted Wednesday, November 07, 2012 1:46 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 1:08 AM
Points: 2,369,
Visits: 4,411
vs.satheesh (11/6/2012)
I face one interview question.One salary table i have three column like (id,name,salary)
Table Name:SalaryDetail
id name salary
1 arun 1000
2 jothi 2000
3 kavi 3000
4 rahul 4000
5 jeeva 5000
In this above i want following result
id name salary Salry2
1 arun 1000 null
2 jothi 2000 1000
3 kavi 3000 2000
4 rahul 4000 3000
5 jeeva 5000 4000.
Please reply this .
What is the business logic by which you got the 4th column( Salry2 )?
Though it is a bit evident, it would be better if you put it in words as otherwise people would only be guessing
Additionally, if you include some code which you have come up with, we can be assured we are not spoon feeding you
Kingston Dhasian
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1381826
Kingston Dhasian
Kingston Dhasian
Posted Wednesday, November 07, 2012 1:50 AM
SSCrazy
Group: General Forum Members
Last Login: Today @ 1:08 AM
Points: 2,369,
Visits: 4,411
CELKO (11/6/2012)
Now we have to track down this interview so we can tell them that you cheat. I have gotten two students and one lecturer kicked out of their schools for this kind of academic dishonesty.
How does the thread classify as "Academic dishonesty"?
The OP is most probably a job seeker and not a student. He is asking this question after the interview to gain some knowledge which he doesn't have now.
He would have been dishonest had he asked the question during the interview process which is highly unlikely.
Kingston Dhasian
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1381829
Eugene Elutin
Eugene Elutin
Posted Wednesday, November 07, 2012 1:52 AM
SSCrazy
Group: General Forum Members
Last Login: Yesterday @ 9:40 AM
Points: 2,596,
Visits: 4,507
CELKO (11/6/2012)
...
Now we have to track down this interview so we can tell them that you cheat
...dishonesty...
So, can you claim that you have never-ever lied yourself?
I guess OP had the interview already, and couldn't answer the question he is asking to help with...
_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)
How to post your question to get the best and quick help
Post #1381832
Jason-299789
Jason-299789
Posted Wednesday, November 07, 2012 2:07 AM
SSC Eights!
Group: General Forum Members
Last Login: Yesterday @ 10:57 AM
Points: 838,
Visits: 2,200
I think they were probably testing your knowledge of Joins, it would be interesting to see what you think the solution is before putting up how I would have coded.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
Post #1381834
Abu Dina
Abu Dina
Posted Wednesday, November 07, 2012 2:25 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Yesterday @ 4:21 PM
Points: 512,
Visits: 2,245
I think the question is to see if you know how to transpose rows to columns.
-----------------------------------
http://www.SQL4n00bs.com
Post #1381839
Sony Francis @EY
Sony Francis @EY
Posted Wednesday, November 07, 2012 2:33 AM
Valued Member
Group: General Forum Members
Last Login: Friday, May 17, 2013 6:07 AM
Points: 62,
Visits: 227
Using inner join A.id=B.id-1
Using cte expression and join
Post #1381843
Jason-299789
Jason-299789
Posted Wednesday, November 07, 2012 2:38 AM
SSC Eights!
Group: General Forum Members
Last Login: Yesterday @ 10:57 AM
Points: 838,
Visits: 2,200
The inner join wont work where Id 1 which needs to return a NULL value, based on the sample data provided, so you would need a Left outer join, to the prior record based on Id.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
Post #1381849
« Prev Topic
|
Next Topic »
12 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.