814 reputation
111
bio website
location Ukraine
age
visits member for 1 year, 3 months
seen 1 hour ago
stats profile views 47

Jun
3
comment Embedded select with rank
Maybe there's no need to write another answer. There've been quite a few already, yours included. Since you've got enough reputation, you could just suggest closing this question as a duplicate.
Jun
3
comment Embedded select with rank
There are many suggestions in this thread.
Jun
3
comment Embedded select with rank
And by the way, you could simplify the score expression a little: floor(avg(100 * (ans = word))) as score.
Jun
3
comment Embedded select with rank
How should the case of 93, 79, 79, 66 be ranked? Should it be a) 1, 2, 3, 4, b) 1, 2, 2, 4, or c) 1, 2, 2, 3? If a), how should the query determine which userid must be assigned which ranking in case of ties?
May
31
comment How to add custom sequence number in table which is going to be populated automatically
You don't need a column for that, unless we are misunderstanding each other. You could use ROW_NUMBER to generate row numbers every time the query is run. If you need fixed numbers, however, then that is what the IDENTITY property is for, and you are already using it for one of the columns. Of course, that cannot enumerate different types of bills independently, if that's what you are after.
May
31
comment Create a Leveling of Intermediaries
Could you provide a data sample and the expected result for it? On a different note, your schema doesn't look very convenient to work with. For instance, why do you need to store two levels of nesting in the same row? One would be enough, i.e. IntermediaryPK and ParentIntermediaryPK. To access the grandparent's PK, you would self-join and get the parent's ParentIntermediaryPK. Also, why do you need to duplicate the IDs? Again, you can join the table to itself to get the ID of the parent, and self-join once more to get the grandparent's ID. So, consider modifying your schema.
May
31
comment How to add custom sequence number in table which is going to be populated automatically
Do you mean it would only be used for display purposes?
May
31
comment How mysql process where condition
Basically, SQL is a declarative language. You tell what you want, the server figures out how best to achieve that. From what I've learnt this far, you only need to start worrying if the performance is really bad.
May
29
comment Relation to original tables or to existing linking table
I've got no answer essentially and therefore will post none, sorry. I was only commenting on your options. But as an illustration to what I was talking about, here's a SQL Fiddle with the schema I had in mind.
May
29
comment Relation to original tables or to existing linking table
Well, yes. I did mean to suggest using the two columns (in settings) as a compound foreign key referencing the event_guest's compound PK, simply to make sure a settings entry cannot exist without an event_guest one, but if you have other means of ensuring that, you could easily go with the option 2, of course. I must admit, though, that I can't advise you on which way of formal referencing would be better in terms of performance. That might depend on how often you needed to join settings to guests and events in comparison to joining it to just event_guest, but I'm not sure.
May
28
comment validate where each parent intermediary is also a parent to itself
Thank you! But please update your question instead of just replying to me. (Use the Edit link underneath it.) My point was that your question didn't sound well enough to attract any help, and by updating your question with what you have tried you will at the very least be letting the people know that you are not being lazy. Also, to help you to improve your question further, please elaborate (in your question) on which rows in your example should be returned by the query you are trying to build, and why. That's just to make sure the goal is clear. (I, for one, am not sure I've understood all.)
May
28
comment Relation to original tables or to existing linking table
Do you want/need settings on a particular guest/event pair without their being an event_guest entry? That, in my opinion, should be the first thing to affect the decision. If you go with the first option, you could consider foregoing the event_guest.id surrogate primary key and using (events_id, guests_id) as a compound primary key instead.
May
28
comment validate where each parent intermediary is also a parent to itself
Well, you've restated your intention, thanks for that. But you haven't answered either of my questions. I'll be fair with you and repeat them as well: 1. What have you already tried? 2. What exactly is difficult for you at this point? What are you struggling with? Honestly, so far your question reads basically like this: "I want to do this thing but I don't know how to and so I won't do it. Please someone do that thing for me." I don't think this can attract many helping hands.
May
28
revised validate where each parent intermediary is also a parent to itself
improved the helper scripts (a redundant comma in CREATE TABLE, missing commas and redundant quotes in INSERT)
May
28
comment validate where each parent intermediary is also a parent to itself
What have you tried? What poses a particular difficulty at this point?
May
28
suggested suggested edit on validate where each parent intermediary is also a parent to itself
May
19
awarded  Caucus
Mar
20
comment Performance about this simplified where-condition query
This would seem more on topic on Database Administrators. Voting to migrate.
Mar
19
revised Find “n” consecutive free numbers from table
added one more demo link, change the other one to use the version 9.1.8, added a note
Mar
19
revised Find “n” consecutive free numbers from table
expanded in response to the question's update