I have this table: trafico.2019 Where I need to select different kinds of traffic (combinations of variables grouped in the following query) Q1 So I know the records for each kind of traffic combination Now I want to set a threshold: 25% of the average of each type of traffic, which I get to know with the fol…
SQL Sub-Query Multiple Columns [closed]
I have a dataset containing a list of recorded coronavirus cases in countries across the world through a time period of December 2019 to April 2020. I am trying to write an SQL query to give a a …
INSERT INTO a whole list with python and SQL
I’m inserting data in a database with INSERT INTO The main problem is that I’m inserting around 170k points of data and I’m looping a code like that: for row in data: SQL=”’INSERT INTO Table …
CONVERT_TZ() equivalent in Oracle
I am trying to convert a timestamp value of the format YYYY-MM-DDTHH24:MI:SS to another timezone value YYYY-MM-DD HH24:MI:SS.SSSSSS. I was able to do this in MySql using the CONVERT_TZ(date, from_tz, …
make column unique in context of one foreign key entity
So let’s image a database scheme for todos. Your todo table would be id (PK) owner_id (Foreign key on user table) title Of course the title column can’t be unique because each user can have a todo …
Maximum number that can be returned by 2 Natural Joins
Given relations A(a,b,c), B(e,f), C(d,g,h), where A has 800 tuples, B 200 and c 500. In worst case gives the expression A * B * C ( with * natural join) : a) 800 tuples b) 200 tuples c) 500 tuples …
SQL Query to LINQ (use join with two keys)
I have got SQL Query and trying to use LINQ because if EF. Can someone have a look at it tell me where is my mistake, please? SQL Query is working but LINQ returns no data. Basically there is two table A and Table B. I want to do join AB which is (Bring me Data exist in Table A
Percent change with grouping variables
I have four grouping variables Month, State,County, City. In addition I have the metric column sales which can be null I would like to calculate the percent change of sales per month for each City. My solution would have the same grouping but with the sales column replaced by percent change for each month in …
Entity Framework Core 3.0 .Include call taking 10x more time
I reviewed almost everything online but couldn’t get it work in a reasonable time. Entity Framework Core 3.0 .Include call is taking 10x more time than calling the individual tables separately and then mapping them in C# code. I have two tables product and productimages, where product productimages is a…
How to create a new column and add values to it based on a condition in MySQL?
this code I have tried the above code and surely there is a mistake. there are two columns studentID and marks. and I need to arrange them in student ID order and also create a new column and say “yes” or “no” if marks are divisible by 10. Answer Just do this first: Then, update data i…