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!":-D
(So many miracle inventions provided by MS to us...)How to post your question to get the best and quick help