Skip to content

Tag: mysql

How the db model should be for this scenario? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question I’m modeling a database scenario but I’m not understandin…

Mysql Mariadb recursive query

I have the following table : and a recursive query on it : which works and prints the following result : I would have liked to add an extra column to the result, namely “parent_name”. How do I do this? Edited to add: https://stackoverflow.com/a/22376973/2027239 That was the answer on an older ques…

ORDER BY num-rows of another table

I have to create a ranking of the directors who have made the most reviews. What is the method for reordering according to the number of rows in another table? Table 1 (director) Table 2 (employee_reviews) Result (Directors ranking): Answer You need to join to your table and select the count when (ON) the aut…

SQL groups inside groups

I have transaction data like this example: Name | Price George | 20 George | 20 George | 20 George | 30 Paul | 20 Paul | 20 Paul | 30 Paul | 30 Paul | 35 I need to group by …