Skip to content

Group numbers by 45 in mysql

I have a database in which I store wind direction readings by degrees. I need to do two things really, i need to group all readings by 45 (basically 45 degrees between “N”, “NE”, “E”, “SE”, “S”,”SW”,”W” and “NW”) a…

What is the maximum value for STRING ordering in SQL (SQLite)?

I have a SQLite database and I want to order my results by ascending order of a String column (name). I want the null-valued rows to be last in ascending order. Moreover, I am doing some filtering on the same column (WHERE name>”previously obtained value”), which filters out the NULL-valued row…

SELECT query without FROM clause with a million rows

I’m trying to generate a million rows for a database table using SQL. The logic for the columns is in place, but I’m not sure how to go about generating a large number of rows without having a FROM clause. I’m aware of how to write the SQL query without a FROM clause – select ‘a&…

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…

How to select the latest date for each group by number?

I’ve been stuck on this question for a while, and I was wondering if the community would be able to direct me in the right direction? I have some tag IDs that needs to be grouped, with exceptions (column: deleted) that need to be retained in the results. After which, for each grouped tag ID, I need to s…

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…