June 8, 2016 at 8:11 pm
Comments posted to this topic are about the item The altered view
June 8, 2016 at 10:22 pm
Good question Steve, nice gotcha!
...
June 8, 2016 at 10:58 pm
This was removed by the editor as SPAM
June 9, 2016 at 2:50 am
D'oh, I must be blind...completely failed to notice the column in the view was called Qty while the SELECT was querying against OrderQty. :crying:
June 9, 2016 at 8:15 am
paul.knibbs (6/9/2016)
D'oh, I must be blind...completely failed to notice the column in the view was called Qty while the SELECT was querying against OrderQty. :crying:
K-K-K-Kofee ... must ... get ...
June 9, 2016 at 8:22 am
A subtle one, and I saw the answer right away. I love it when that happens!
And I haven't had my morning bottle of Starbucks yet, but I did sleep at a Holiday Inn last night. 😉
-----
[font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]
June 9, 2016 at 9:14 am
Thanks for the Gibbs head slap - I feel like a bona fide probie on this one.:w00t:
June 9, 2016 at 10:10 am
Good question, good explanation. Thanks, Steve!
June 9, 2016 at 11:59 am
Thanks for the question, really good one.
yea, well, as we do typo when typing... this was completely clicko. (when I saw red, I was like "WHA......T"?... then I saw it I clicked the third one....)
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
June 9, 2016 at 2:33 pm
Nice question and nice clear explanation. The third easy question in a row.
I was surprised to see how many got it wrong so far (more than 200 people - 38% of those who answered), because there's nothing the least bit obscure about the view definition and it clearly isn't incorrect so the definition will succeed, and the view clearly doesn't have the column asked for in the second query so that will fail with an error message.
Tom
June 9, 2016 at 2:55 pm
I have to say I ran into this a week or so ago when I saw Joe Celko's article on Simple Talk (). In 25 years, I hadn't ever seen, or at least remembered, seeing a column list in a view definition. It's something I do in CTEs about half the time, but it makes sense it works in views as well.
Not sure I think this was easy, as before I'd read the article, I'd have assumed that CREATE VIEW myView (...) as ... was invalid.
June 10, 2016 at 5:23 am
I had to look it up, as I've never seen the column names in the view definition either. So, I learned something new, which is always a good way to start the day.
June 10, 2016 at 11:03 am
The oldest DB book that I have at hand is The Practical SQL Handbook, published in '89 by Sybase/Addison-Wesley, and it shows the column names being defined as part of the Create View statement, before the Select portion. My A Guide To Sybase and SQL Server by D. McGoveran and CJ Date ('92) also shows this syntax.
I knew that as soon as I started clearing my office of my books for my departure at the end of the month that I'd need to look something up.
-----
[font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]
June 17, 2016 at 9:25 pm
Nice question & explanation. Thanks Steve.
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply