The COVID-19 tracking project (api described here) provides data on many aspects of the pandemic. Each row of the JSON is one day’s data for one state. As many people know, the pandemic is hitting different states differently — New York and its neighbors hardest first, with other states being hit …
How to use PostgreSQL column value with some calculations as second column value
I am inserting a huge data set into the SQL table and I want to achieve something like this. The problem is I don’t want to call generate_series function for b and c. I want to take the value of a and perform mod on it for b and c like below or even efficient way but I am unable
Top-N By Decade for successive decades (in SQL Server)
I’m trying to get a ranked list of Top 5 (i.e. most common) document titles, grouped by decade, for each of the 6 most recent decades. The document titles are non-unique. There could be dozens or even hundreds of documents with the same title in any given calendar year. The following query is as far as …
Row sorting and selection logic in Python on Sqlite db
hello Thanks for taking the time to go through my question. I work in the budget space for a small city and during these precarious time, I am learning some python for maybe in the future helping me with some financial data modelling. We use SAP currently but i also wanted to learn a new language. I need some…
Query to join two tables with like operator
I have two table which has data as below Table1 I would like to create where clause to get rows with like operator. for ex. But my problem is that there are more than 15-20 different parameter in where clause, it can also increase latter. So I have decided to create a new table in database lets called it Tabl…
Get the latest child messages and also parent messages that are childless
The following is the Message model message_participants has a record for each message and the various people who have sent or received that message. It has a user_id on it. The problem with the above latest_messages_by_participant scope is that it is able to get all the child messages BUT it gets only the las…
Can I update a SQL table based on data from another table, with unknown data? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I’m making a NetBeans Servlet which accesses a MySQL database; and updates data based …
Compare values in Different column and row
I have the following table: What I need is to select all rows where Col1 value is available in Col2 and vice versa. This case only ROW 4 or ROW 3 should be returned. They have same values (13 17). Take it as col1 is Buyer and col2 is Seller I want to know who are the users who bought
SQL Query giving wrong output
I have written this code to find “For each year, count the number of movies in that year that had only female actors”. WITH k AS …
PostgreSQL – Why 1 search paramater works, but not the other? (multiple joined tables)
So I have a query that I run that basically looks like the one below (simplified it though for easier viewing). When I search on user_orders.orderID it works flawlessly, but if I try to search by …