Skip to content

Tag: mysql

how to extract and zip values from json with SQL, mysql

I struggle to extract the required values from the JSON column in MySQL. Imagine the variable: and I need to extract and return a new JSON array containing only selected key-value pairs, eg.: only a’s and b’s and if the required key does not exist I want to return null for that key: thanks Answer …

How merge these two sql queries in mysql?

I want to merge below two queries and display two p_artist.id count based on the condition of each band name but I am not getting any clue. Can anyone help me, please? Thanks Answer I mean I want to have two-column of count ids The requirements are not clear at all and I had originally typed a separate answer…

SQL query with meta_key,meta_value and have 2 conditions

I am trying to do an SQL query to find a form id of the Registration form of the user on a wordpress site, because this form doesn’t have the id of the user yet, I have to find the user email which is unique and check if the gdprchekbox-1 is true because it is only used for the registering

SQL JOIN tables and and sum columns with the same PK

Here are my tables: Players Name DoB Ranking Ben 01/01/1999 1 Tom 02/01/1999 1 Sam 03/01/1999 1 Sam 03/01/1999 2 Ranking Ranking Points 1 100 2 50 I want to join the tables and add the total points for each player then output this table. Output Name DoB Points Ben 01/01/1999 100 Tom 02/01/1999 100 Sam 03/01/1…

Optimizing select union select oracle

I had an interview recently and the recruiter told me to make a query on a table USERS with two fields (name, age) which should return a list with two columns | NAME | MAJOR OR MINOR | My response was this : Then, he told me that is correct, but we can do better! So, my question is: How

Do i need to cast integer param to string for varchar index to be used?

When i query a varchar column (indexed) against an integer number, it runs extremely slow. I thought mysql was able to infer this and cast the parameter to string, but when i use an integer for filtering it avoids the index. Is this ok? Is it a collation problem? Should i always cast manually integers to stri…