I have a doubt on this sql problem. Here is the tables. I currenly have all the characters names that died on Episode 3, but I don’t know how to get the character killers. Any idea? Select name from …
Tag: mysql
How to refactor my python to use a SQL Prepared statement?
Code to accept input from the user and gives a User for a given username. Now it is accepting the input directly into the SQL query but I would like to use it with prepared Statements, how could I do …
Inconsistent delete query with left join of multiple tables
I have three tables in MySQL v5.6 created by: CREATE TABLE tm ( id INT AUTO_INCREMENT, PRIMARY KEY (id) ); CREATE TABLE th ( id INT AUTO_INCREMENT, PRIMARY KEY (id) ); CREATE TABLE tr (…
SQL : get number of user but order date [closed]
I trying to get how many user i got in a precise day compared to the first order for exemple : “2020-02” = 20, “2020-03” = 20 … etc… I did an sql query like that : SELECT o….
Why do double quotes influence result in compareing datetime?
Why do these two results dont return the same results? Can anyone explain why? (addtime is datetime type.) Answer This does not do what you want: Unquoted 2020-10-10 is an arithmetic operation, which returns integer value 2000. You are then asking MySQL to compare it with a date, so it tries to convert the in…
mysql – Search for a key within inconsistent json structure
I know of the functions such as: JSON_SEARCH() and JSON_EXTRACT() etc. This issue is that I am searching for a key in a json string that is not standardized. for example: and the results could be something like this: so in this example I want to get john doe with the acctNum of 123. but, also, the location of…
how to count all rows are approved in sql?
I have this line data, where it also shows the status: approved, in progress, not yet started. I need to count how many lines are ALL APROVED based on the line colors. the data is similar to this: the query should show that there is only color (which is green) that all the status are approved, because red sti…
Getting total from query of individual groups
I’ running a query that returns total count of offices per county. and my results look like this: Is there a way to get the total count returned in the same query? Answer If you want it as a column, use a window function: If you want it as an additional row, then use WITH ROLLUP:
SQL Query from getting SubChild to Child to Parent Tables
Good day, I’m trying to create a custom query for my scenario. Here’s the DEMO I created. Suppose I have 2 or more parent tables and this table will be consume by a child table. tblParent1 tblParent2 tblParent3 Then there’s a child table where it consumes these 3 parent tables. tblChild And …
I can’t get specific row’s postition in table using order by in MySQL
I want to get position of specific row in MySQL table using operation ‘order by’. Let’s say i have this table: And now i want to order them by user_points (ascending) and get Ann’s position in here. The output I desire is ‘3’. I was trying to do it, but with no results̷…