Mysql – SQL how to drop rows based on values from two columns
I have a SQL query result I would love to clean up, the query result is following NAME OPT_IN JOHN TRUE JOHN FALSE KEK TRUE and now I want to select | JOHN | FALSE | when | JOHN |…
I have a SQL query result I would love to clean up, the query result is following NAME OPT_IN JOHN TRUE JOHN FALSE KEK TRUE and now I want to select | JOHN | FALSE | when | JOHN |…
I am trying to count the number of days between two dates that are present in the same column! when the ID is are same. Here is a sample below... ID Date a 01/12/2024 a 01/13/2024 b 01/12/2024 b 01/20/2024…
I want to have a result of unique row of id, date_col1, with max (or last) of date_col2, and the value contained in the same row as max(date_col2). My table is like this sample: id date_col1 date_col2 value 1 2023-01-02…
In the following scenario, there are 3 tables in a PostgreSQL database (tables and values are simplified for clarity). I am trying to get the following values: sum of the amounts for records (101, 102, 103) in the parent table…
Im wondering what the best practice is for my table layouts to be for a many to many realtionship. To set the scene we have 2 tables. A table of people, and a table of locations defined as follows CREATE…
I want to select all columns from table A and just one column from table B, the information is related so I tried to join tables, but didn't work. The following setup can be used as example, note that genreId…
Given a table that looks like the following: +---------------+----------+ |title |enabled | +---------------+----------+ |Four |N | |Two |N | |Three |N | |One |Y | |Five |Y | |Six |Y | +---------------+----------+ Using keyset pagination and sorting by enabled, how…
I was given an image of a sql database model and asked to extract information from it. how do i convert or transcribe the image into something I can do this with? I don’t know what to try because the…
I am trying to build an SQL search from input field "postcode" with multiple zipcode. My input field is working like that: user add different zipcode (french), the value of the input (name = postcode) is: value="35200, 53333, 23400" the…
I have a SQL table with the following data: | Name | Colour | Shape | | -------- | ------------------ | ---------------- | | Bob | Blue, Green | Circle, Square | | Phil | Yellow | | | Steve…