I'm new in database designing. What I intend to do is that I allow users of my website to form groups and groups have admins and admins can define permission levels(each permission level belongs to its own group and groups do not share permissions). then role table assigns permissions to users. now I'm not sure which way shows permission ownership and user-permission relation better.
I have two ideas, hope you can help me chose one or modify them.
I guess design 2 looks easier for query but I'm not sure if its complexity and efficiency is ok or not.
Unfortunately, neither diagram corresponds to your written description, and the description isn't clear enough for me to understand your requirements. I suggest you write out what you want in the following form:
Each user belongs to 1 group
Each group contains 1 or more users.
Each permission level belongs to one group.
Each group has 1 or more permission levels.
You have to write each relationship in both directions. You can even do the same for the attributes - beginners often impose their own assumptions about how the world is structured onto their database designs, but intuition usually isn't the best design guide.
What these sentences do is to analyze your requirements in the form of binary relations, and from the cardinalities ("each", "0 or 1", "exactly 1", "1 or more", "0 or more") one can work out the tables and relationships without much difficulty.