812 reputation
111
bio website
location Ukraine
age
visits member for 1 year, 2 months
seen 15 hours ago
stats profile views 39

Feb
2
comment Dissecting Joins
No, I'm not aware of any resource that could be helpful in this situation, sorry.
Feb
2
answered Dissecting Joins
Feb
2
comment Dissecting Joins
Of course. And I will have to jump to that question and back while writing my answer, thank you very much. :)
Feb
2
comment Get counts grouped by month and year
This doesn't compile. Why did you change the GROUP BY?
Feb
2
comment Dissecting Joins
Try on a smaller dataset and with a smaller number of joins. Also, I think you should incorporate the query you are asking about into your question as its integral part.
Feb
1
comment return percentage of records based on value in column
Thank you very much for your effort, Martin. And sorry about cluttering your comment thread.
Feb
1
comment return percentage of records based on value in column
@SQLKiwi: Thanks, this does seem worth posting as a question. I doubt I will post it myself, though. Primarily because I'll be unable to provide the necessary details or fail to do that properly due to my inexperience. Mind you, I was even unable to spot that the plans I mentioned previously used different kind of spool (Table vs Index)! Of course, asking a good question doesn't necessarily require good knowledge, but in my particular case it would also be poor quality. I'll be happy if Martin takes the trouble, although he seems to have already make his mind up about this being a bug.
Jan
31
comment return percentage of records based on value in column
When you do, you'll find that the plans are almost completely identical. They only differ slightly in the non-zero percentages (both table scans' costs are 17% each for table vars versus 16% for tables, and the index spool's cost is 67% vs 68%).
Jan
31
comment return percentage of records based on value in column
I deleted my answer after discovering that it didn't work with (real) tables. I tested locally using table variables, it worked fine with them, but not with tables.
Jan
31
revised Update Table with Network Client Connection Status, I need help with DB design. SQL 2008 Ex R2
edited tags
Jan
29
comment What is the correct result for this query?
@ypercube: I'm still puzzled as to the reasons for this difference. But to be honest, I've already used GROUP BY () as a way of adding the grand total only when there are details. Omitting GROUP BY would yield an extra row. Or I would have to use an IF (or a WHERE EXISTS, perhaps).
Jan
29
comment What is the correct result for this query?
Want more? SELECT 1 WHERE 1=0 HAVING 1=1;. SQL Server and PostgreSQL still return one row. Oracle wants FROM DUAL and returns no rows. MySQL doesn't compile neither with FROM DUAL nor without it.
Dec
16
revised How can I correctly choose maximum number of occurrences of a string while grouping by another field?
added a version-specific tag
Dec
16
suggested suggested edit on How can I correctly choose maximum number of occurrences of a string while grouping by another field?
Dec
2
comment Conversion of statements to E-R Diagram
Thank you for the explanation as well as for the update. What you noted in your update is one other thing that bothered me and it was probably the source for the misapprehension expressed in my first comment. @ypercube: Thanks, I agree now.
Dec
1
comment Conversion of statements to E-R Diagram
Looks good to me but something seems definitely missing. According to this chart, a teacher can teach many courses and be a mentor of many students. But the chart also seems to imply that the many courses a student enrols in are supposed to be taught by the same teacher, who is also the student's mentor. Is that actually all right?
Nov
25
revised MySQL performance tuning
replaced textspeak, fixed some grammar, improved punctuation and formatting
Nov
25
suggested suggested edit on MySQL performance tuning
Nov
23
answered “Log file for database is full” running an INSERT statement
Nov
16
answered MySQL optimization - year column grouping - using temporary table, filesort