patternsqlMinor
Fascinating, ma'am
Viewed 0 times
fascinatingstackoverflowprogramming
Problem
Finding a famous question with high score I haven't voted on yet was proving to be a bit difficult for me. So I came up with this simple SEDE query to find good candidates:
Can this be improved in any way? (Btw, I'm a total noob with SEDE.)
SELECT TOP 10
Id AS [Post Link], ViewCount
FROM Posts
WHERE ViewCount >= 10000 AND Score >= 25
ORDER BY ViewCount DESCCan this be improved in any way? (Btw, I'm a total noob with SEDE.)
Solution
General Feedback
With a query this short it's hard to go wrong, and you haven't. The formatting is consistently
I really can't find anything to complain about, you've got a nice query.
A Small Suggestion
Have you considered adding parameters to the query. That way if you, or someone else, want to run using different numbers for the minimum
SEDE provides a special syntax for parameters, which looks like this:
where
With a query this short it's hard to go wrong, and you haven't. The formatting is consistently
SHOUTCASE for keywords, as per convention. And there is nothing glaringly wrong at all.I really can't find anything to complain about, you've got a nice query.
A Small Suggestion
Have you considered adding parameters to the query. That way if you, or someone else, want to run using different numbers for the minimum
ViewCount or Score then they wouldn't need to alter the query.SEDE provides a special syntax for parameters, which looks like this:
##MinViewCount:int?10000##where
MinViewCount is the parameter name, int is the data type and 5 is the default valueSELECT TOP 10
Id AS [Post Link], ViewCount
FROM Posts
WHERE ViewCount >= ##MinBadges:int?5##
AND Score >= ##MinBadges:int?5##
ORDER BY ViewCount DESCCode Snippets
SELECT TOP 10
Id AS [Post Link], ViewCount
FROM Posts
WHERE ViewCount >= ##MinBadges:int?5##
AND Score >= ##MinBadges:int?5##
ORDER BY ViewCount DESCContext
StackExchange Code Review Q#73902, answer score: 3
Revisions (0)
No revisions yet.