December 27, 2017 at 9:02 pm
Comments posted to this topic are about the item Christmas 2017 - Part 4
December 28, 2017 at 12:01 am
Cheers Steve but a bit of a typo in this one too, cut and paste have a lot to answer for!!
...
December 28, 2017 at 12:30 am
Very hard to know if 'Adult' refers to the Age or Genre for the movie "'s a wonderful life"...
December 28, 2017 at 2:58 am
Hi Steve,
In the 4th row number of values is incorrect as there are only 4 values in it and there are 5 values in other rows. So we got the following error message:
Msg 10709, Level 16, State 1, Line 8
The number of columns for each row in a table value constructor must be the same.
If we insert an additional value (an arbitrary one) after 'George Bailey' then the query will produce the 'George Bailey' as a result in both cases if we order by genre or age.
See the attached screens:
So I think the "genre" is also a correct solution.
December 28, 2017 at 3:35 am
sandor.reti - Thursday, December 28, 2017 2:58 AMHi Steve,In the 4th row number of values is incorrect as there are only 4 values in it and there are 5 values in other rows. So we got the following error message:
Msg 10709, Level 16, State 1, Line 8
The number of columns for each row in a table value constructor must be the same.
If we insert an additional value (an arbitrary one) after 'George Bailey' then the query will produce the 'George Bailey' as a result in both cases if we order by genre or age.
See the attached screens:
So I think the "genre" is also a correct solution.
I think if you use the corrected line for QOTD Part 3 the solution works out correct, I believe this is the same error as the previous question; the genre would then be "Classic" and not "Adult". Steve?
...
December 28, 2017 at 5:18 am
'''s broken again
December 28, 2017 at 7:45 am
Rune Bivrin - Thursday, December 28, 2017 12:30 AMVery hard to know if 'Adult' refers to the Age or Genre for the movie "'s a wonderful life"...
Adult is an age and not a Genre. Although, some might argue that Adult is a genre, but it's definitively not the genre for It's a Wonderful Life.
This is what I did to correct the data set.
SELECT *
FROM
( VALUES ('Ebenezer Scrooge', 'A Christmas Carol', 'Old', 'Fiction', 'London'),
('Dumbledore', 'Harry Potter and the Sorcerer''s Stone', 'Very Old', 'Fantasy', 'Hogwarts'),
('Frosty', 'Frosty The Snowman', 'Infant', 'Animated', 'A small town'),
('George Bailey', 'It''s a Wonderful Life', 'Adult', 'Drama', 'Falls')
) AS a (SomeName, Movie, Age, Genre, Locale)
December 28, 2017 at 10:32 am
Well, I thought I corrected this yesterday. Apparently I must not have saved the changes. Code should be:
SELECT TOP 1
answer = SomeName
FROM
( VALUES ('Ebenezer Scrooge', 'A Christmas Carol', 'Old', 'Fiction', 'London'),
('Dumbledore', 'Harry Potter and the Sorcerer''s Stone', 'Very Old', 'Fantasy', 'Hogwarts'),
('Frosty', 'Frosty The Snowman', 'Infant', 'Animated', 'A small town'),
('George Bailey', 'It''s a Wonderful Life', 'Adult', 'Classic', 'Bedford Falls')
) AS a (SomeName, Movie, Age, Genre, Locale)
ORDER BY
December 28, 2017 at 12:36 pm
Don't worry, Steve. As it was before the correction was good enough to figure out the correct answer. Thanks for the question!
December 28, 2017 at 5:35 pm
Revenant - Thursday, December 28, 2017 12:36 PMDon't worry, Steve. As it was before the correction was good enough to figure out the correct answer. Thanks for the question!
Cheers
January 2, 2018 at 2:13 am
Nice one, thanks Steve (Glad i got to answer this after corrections applied)...
____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply