Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Reg: Interview Questions Expand / Collapse
Author
Message
Posted Tuesday, November 06, 2012 4:59 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 4:30 AM
Points: 61, Visits: 367
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
Posted Tuesday, November 06, 2012 5:01 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 12:20 PM
Points: 41,529, Visits: 34,445
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
Posted Tuesday, November 06, 2012 6:13 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

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
Posted Wednesday, November 07, 2012 1:46 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, April 10, 2014 5:09 AM
Points: 2,567, Visits: 4,654
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
Posted Wednesday, November 07, 2012 1:50 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, April 10, 2014 5:09 AM
Points: 2,567, Visits: 4,654
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
Posted Wednesday, November 07, 2012 1:52 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, April 03, 2014 10:10 AM
Points: 2,792, Visits: 4,874
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
Posted Wednesday, November 07, 2012 2:07 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 7:37 AM
Points: 860, Visits: 2,323
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
Posted Wednesday, November 07, 2012 2:25 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Wednesday, April 09, 2014 2:57 AM
Points: 704, Visits: 3,270
I think the question is to see if you know how to transpose rows to columns.

---------------------------------------------------------


It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens

Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Post #1381839
Posted Wednesday, November 07, 2012 2:33 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, April 03, 2014 4:01 AM
Points: 63, Visits: 277
Using inner join A.id=B.id-1

Using cte expression and join
Post #1381843
Posted Wednesday, November 07, 2012 2:38 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 7:37 AM
Points: 860, Visits: 2,323
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 »

Add to briefcase 12»»

Permissions Expand / Collapse