i’m trying to get the values which Dates bigger then 2021-07-17 and Cities starting with ‘G’. I have id in the PERSON table, id (references from PERSON(id)) and date in VACCDATA table, id (references from PERSON(id)) and city in ADDRESS table. While i only want the Row 2 (because it’s …
Tag: mysql
How to count and order correctly result from table
I have like this task currently: (sql fiddle: http://sqlfiddle.com/#!9/431723/49/0) It is necessary to form a SQL query to the files table which displays the number of files based on the success of the conversion and the presence of a good rating from registered / unregistered users. Output format: user_type …
SQL Query for grouping within a segment with a condition
We need to select all the columns. Condition: Within a single MAT+PLANT If any vendor crosses 80% we take records of that vendor only and reject other records within that MAT+PLANT. If within a single MAT+PLANT If all the vendors have below 80%, we consider all the records. As shown in the image: Have attache…
What is the default limit for auto generated primary Column(Integer) in SQLAlchemy with FastAPI and MYSQL?
Currently, I’m using Python’s fastAPI with SQLAlchemy and MYSQL. I’ve defined an auto-generated primary column as shown below. What’s the maximum number that this column can hold? Currently, the DB grows by 10k records per day, and I clear 70% of it on the weekends. The number of recor…
SQL – how to remove whole row if one of the column in subquery return NULL
I am stuck in 1 SQL query This query return 4 row ( As shown in the screenshot ) I want a scenario like : If subquery return NULL , then the whole row will not be shown. So in this example “childthree” should not be shown , as “parent_user_email” is NULL , so the whole 3rd row need to
Find floating-point numbers
I have a table Balance with a column Coins of double type in my MySql database. However, in fact, I store int values there. So, I want to change the type from double to int. But before, I want to be 100% sure that there are no floating-point numbers in this column. What kind of SQL request should I write
Given a list, how to get the count from mysql table?
Given a string list, I want to get the count of each item from the table. However, I don’t know how to get the count(0) of item which does not exist in the table. for example, I have a table as follow. Given a list [“aaa”, “bbb”, “ccc”] , I hope a query can return me …
MySQL column to show the sum of column in another table
I have two tables in SQL both hold the ID of users. Table Accounts Table Transactions The table accounts column points should have the sum of that ID in table transactions. So in table one, the output should be points of ID 1 to be 5 and id 2 to be 20. I am new to MySQL so if you
MySQL keyword aliases
I would like to set up aliases for MySQL keywords for faster typing of repetitive (or any, really) queries. Example: -> becomes: How could I go about achieving the above? I have looked around but unfortunately, most searches point to column and table aliases and I did not see a mention in MySQL documentati…
MySQL select unique records from one table with two select queries using NOT IN
TaskNumber JobNumber Status Date 11111 JS0001 0 04-06-2021 11112 JS0002 0 05-06-2021 11113 JS0003 1 05-06-2021 11114 JS0001 1 06-06-2021 Table Tasks. TaskNumber is the unique id(primary key). Status 0 is not done, 1 is done. example: JobNumber JS0001 assigned on 04th of june and not done, so reassigned on 06t…