mysql – need explain for group by behavior

Can someone to explain below group by result

I have a simple table “TableA” like this

ID --- Name (1  --- A_1) (2  --- A_2) (3  --- B_3) 

+when I run below group by

select Name from TableA group by Name 

— result will be

Name A_1 B_3 

Looklike it exclude Name=A_2 in my result

+when I applied below group by + count

select Name,count(1) cnt from TableA group by Name 

— result

Name --- cnt A1   --- 1 **A2   --- 1** B3   --- 1 

It show all rows as expected

I can use distinct to have a correct result for case 1 but still have concern why mysql have that behavior?

Thanks,

My group is too big for my game, how to manage this situation?

So I may have a happy problem. I just finished a game with a group of five players, all of them enjoyed it and we’ve been talking about the next game we would start. None of them are problem players, none of them will refuse the invitation (I think) and ultimately all of them are friends and will know if one is excluded.

However, I find five players to be too much for me: due to the nature of the game we play, the kind of situations I like to set up and the time it takes to go through so many people while having some RP in there. Those issues make it so I have trouble running the game I’d like to run. Making it less enjoyable for me and, I think, for some of the players.

So… How can I, as a GM, deal with a group that’s too big for me if I don’t want to force someone out?

In a perfect world, one or two of the players would drop out of the game of their own volition. But realistically, I would like to drop one or two, which I don’t know how to go about making it happen, or make the game more manageable for the group I have.


Here are a few complications I have:

  • Everyone is friend of everyone else, so merely not inviting someone is just excluding them and hoping they don’t notice or don’t mind being left out.
  • Likewise, everyone seem to be looking forward to the next setting. So I don’t expect anyone to turn down the game unless there is a big change of playstyle.
  • There are no obvious problem-players. The worst I have are follow-along-players. So I have no real ground to expel anyone.
  • The playstyle I’ve found most enjoyable is one of low-combat and more RP and problem solving. Making kind of hard to engage five people.
  • I also find I like to take the time to RP a bit even when resolving mostly basic rolls, so that resolving a full day’s exploration in a single roll and narating the result is not something I want to do frequently.

I found some question close to mine on the site, the closest I have is this one: How can I manage a party that has grown too big?. But it doesn’t help my problem. Mostly because on the focus on Roll20 and dnd (we run a homebrew system for which the closest comparison I have is: Dungeon World with crunchier combat).


For reference, Here are the main avenues I had in mind in case I still have five players for a while.

  • Run the next game in a Westmarch-like style. Off-loading the burden of who is present to the players and giving me a reason to apply time pressure on the players. I’m not sure how feasable this is and may have to resort to selecting two nights instead of one. Based on our current speed. I can’t see how we could run a satisfying game in such a short time (that is partly my fault).
  • Keep the group and keep a close eye on the playtime IRL, keep things focussed. This is what I’ve been doing and I know it has the side-effect of giving little to no spotlight on the players who goes in the wrong direction and the difference between right and wrong direction is jarring in my narration (and I know some players noticed a few time). If someone decides to leave because of it… I can slow down because I have a more manageable group now. If noone dislike it, then I may be alright. But that is not the kind of game I’d like to run.
  • Keep the group and enforce a strict no-splitting rule. See how it goes. I tend to find 5 players+NPCs scenes tough to run and I expect the two least vocal players to just quit talking in such a game. But I can’t find another

Ideal group size for a murder/horror mystery

I am writing a short murder/horror mystery adventure. System will be D&D 5e, and players will be level 2 (I plan to give them the 3rd level during the adventure). There will be some strong DM guidance on character creation. Some players will be very inexperienced in TTRPGs. Playing might happen on a table, or online (with player webcams), probably both. I plan to run the adventure several times, and I have a gut feeling that adventure will take 2 sessions to play through.

The focus will be in role-playing, with no risk of player being taken out of the adventure, until at the very final battles at the end. The focus won’t so much be in really solving the mystery like in a detective story either, but just being swept along for the ride, things happening and then players doing what they will. They may try to solve it or just survive, or even party ’till the end as the place goes down around them (meaning probable death at the end).

It is important that each player gets plenty of spotlight time, but without fear of the game stalling if they don’t play well, and without more introverted players feeling exhausted. So I am thinking of designing the events of the adventure for 3 players, allowing 2 or 4 if it is expected that players play well together.

In your experience, what is ideal group size for an adventure like this? For this group size, should I try to encourage or enforce certain kind of group dynamic, via guiding the character creation? What has worked for you? What has not worked, what has ruined an adventure like this, from group dynamic and player fun perspective.

Generating trusted random numbers for a group?

Alice and Bob need to share some cryptographically-secure random numbers. Alice does not trust Bob, and Bob does not trust Alice. Clearly, if Alice generates some numbers, and hands them to Bob, Bob is skeptical that these numbers are, in fact, random, and suspects that Alice has instead generated numbers that are convenient for her.

One naive method might be for each of them to generate a random number, and to combine those numbers in some way (e.g. xor). Since they must be shared, and someone has to tell what theirs is first, we might add a hashing scheme wherein:

1) Alice and Bob each generate a random number, hash it, and send it the hash to the other (to allow for verification later, without disclosing the original number). 2) When both parties have received the hash, they then share the original number, verify it, xor their two numbers, and confirm the result of the xor with each other.

However, this has a number of problems (which I’m not sure can be fixed by any algorithm). Firstly, even if Alice’s numbers are random, if Bob’s are not, it is not clear that the resulting xor will then be random. Secondly, I’m not certain that the hashing scheme described above actually solves the “you tell first” problem.

Is this a viable solution to the “sharing random numbers in non-trust comms” problem? Are there any known solutions to this problem that might work better (faster, more secure, more random, etc)?

Is there a way to group often used tables and queries in SSMS?

I am not a DBA by training, but due to role shifts I am having to modify and maintain tables and stored procedures fairly often. I would like to visually group tables and stored procedures together in a sort of shortcuts folder. So that when I need to open several related views I don’t have to scroll all over the database. Is something like this possible?

Sorry if this is a dumb question. I am just trying to make this part of my job a little less tedious.

PostgreSQL – Generate multiple running totals w/ group by day (Generate Series)

I’m having trouble figuring out a way to make this query work.

I have a set of transactions of stock purchases by users and I want to keep track of a running balance of each stock as the year progresses. I am using a windowing function to track the running balance but for some reason I cannot get the GROUP BY portion of this query to work.

It continues to have duplicate days in the result set even when I attempt to group by the date (created_at). Sample below:

select   t.customer_id,   t.created_at::date,   sum(case when t.stock_ticker = 'tsla' then t.amount end) over (order by t.created_at::date rows unbounded preceding) as tsla_running_amount,   sum(case when t.stock_ticker = 'goog' then t.amount end) over (order by t.created_at::date rows unbounded preceding) as goog_running_amount, from transactions t group by t.created_at, t.customer_id, t.stock_ticker, t.amount order by t.created_at desc; 

The results here always comes back with multiple records per day, when I want them to be grouped all into one day.

After doing some research I attempted cast the “created_at” to ::date inside of the group by fuction as well, but I get a:

“Column t.created_at must appear in the GROUP BY clause or be used in an aggregate function” error every single time.”

In addition, the results are only going to show the day’s in which a transaction has happened for a user. I need to be able to show a ROW for each day in a time series (1 year) even if the user did not make a transaction on that day. (Using the most recent running balance on the row instead)

I think that using “generate_series” is the proper way to do this, but I am having trouble understanding how to fit it in.

Thank you in advance!

Variation to spanning tree called Group Spanning Tree

Suppose we have a complete graph with say 100 nodes. We divide the nodes in the graphs into groups for example 10 nodes in each group identified by color. We want to obtain an optimal spanning tree that operates under the constraint that at least one node will be present from each group. The resulting spanning tree can be called a group spanning tree. How to write an efficient algorithm for this making sure it is a tree(no cycles) and not looping over the entire node set on every pass to check presence of cycles and also making sure at least one node from each group is represented.

How would a group get from Torvil to Ravenloft and back?

If there were some adventurers who were living in, for example, Neverwinter, and heard rumors about Ravenloft, is it possible for them to get there? Are there people living in Torvil who know how to get to the Plane of Shadow and back somewhat reliably?

How exactly do "Domains of Dread" function?
implies that the DM can just send people there, but that’s not really what I mean, those aren’t reliable to an adventurer.

What would it take for a villain to get his domain transported to Ravenloft on purpose?
seems to think that adventurers need to be evil?
But I don’t think there’s a way back in that path.

Postgresql group by and count() problem, missing row with 0 result

I have a problem with group by and count().
I need a result table looks like below.
Tried I guess all the variations of JOIN.

There are two types of wrong result:
– first when the row “3 C 0” is missing,
– the second when it is present but with a false value “3 C 1

Table1:

id name   1  A   2  B   3  C   4  D   

Table2:

id   1   1   2   1   4   

result should look like this:

id name count   1  A    3   2  B    1   3  C    0   4  D    1   

Any ideas?