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

Weird interview question Expand / Collapse
Author
Message
Posted Friday, May 10, 2013 3:01 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, April 03, 2014 10:10 AM
Points: 2,792, Visits: 4,874
I wonder, if you could discuss questions with interviewer or it was just written test?
Not long ago I was on the interview, where the interviewer asked me to do technical test without any possibility to discuss questions. I have done the test fine, but after it I've told him that I'm not interested in position. If they want to test knowledge this way, they at least must ask some senior SQL expert to validate questions in their tests...
So, some of your questions are also open to wide interpretation.

2. Table Spending has a foreign key reference defined to Customers. Which of the following are true statements?

a. No row can exist in Spending without a corresponding row in Customers with the same key value.
b. No row can exist in Customers without a corresponding row in Spending with the same key value.
c. No row can be deleted in Spending without first deleting corresponding row(s) in Customers.
d. No row can be deleted in Customers without first deleting corresponding row(s) in Spending.
e. There must be one or more rows in Customers with the same key value as each row in Spending.
f. There may be zero but no more than one row in Spending with the same key value as each row in Customers.


a. looks almost right, but not exactly. As it's possible to have row in Spending without a corresponding row in Customers with the same key value, if the key value for Customer in Spending is NULL.
the same goes for d. & e.

9. Which use of subquery is correct and why?

a. where f in (select a from tab1)
b. where f = (select a from tab1)


Try "incorrect" b. sample:
DECLARE @t TABLE (id int, val char(10))
INSERT @t VALUES (1,'acs')
SELECT 'ok' WHERE 1 = (SELECT id FROM @t)

Works fine. So, the right answer will be: "it depends..."

Saying that your questions were much more matured than ones I had.


_____________________________________________
"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 #1451475
Posted Friday, May 10, 2013 7:20 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 2:24 PM
Points: 11,990, Visits: 11,007
GilaMonster (5/9/2013)
Sean Lange (5/9/2013)
The difference between delete and truncate is that delete is a dml operation that is fully logged and truncate is DDL operation and is minimally logged. What that means is the rows are logged in a delete but the page deallocation is logged for a truncate.


Technically truncate is a fully logged operation. Minimally logged means that there is a difference in logging behaviour between bulk-logged/simple and full recovery and that in bulk-logged and simple recovery models the operation logs only enough for a roll back, not enough for a roll forward operation, such an operation flips the appropriate bit in the ML map and results in the next log backup copying the affected extents into the log backup.

Minimally logged does not mean that only the page allocation/deallocations are logged. Many operations, including truncate table, drop table, drop index, select into, insert into, alter index .. rebuild, log only page allocations/deallocations in all recovery models.


Thanks for the clarification and correction.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1451577
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse