Skip to content

Tag: sql

Postgres query return nothing where there should be a valid data

I have a query that should return some rows, but it returns blank. As far as I know .. the pictures down will show the issue. Here is the query This is the table : I tested the calculation and it worked a lone . Answer Your condition cannot be right because you are comparing M.PLAYED_AT to be BETWEEN M.PLAYED…

How to get address by user’s id oracle

In my project, front end needs, following JSON data with this format. So I Created two table for user and their addresses, So I plan to going with this table structure, USER_TABLE USER_ADDRESS Address table I created this way because, each user have two addresses, one is permanent and other one is corresponde…

SQL: subquery for unary table

I’m trying to write a subquery that groups identical TickerSymbols togather as well as TickerSentiment that is between two values e.g. 0.0001 and 1 Sample Rows Query: Output Desired Output Answer You sample code will not work in MySQL But i think you are looking for

Delete all SQL rows except one for a Group

I have a table like this: Schema (MySQL v5.7) id userid date 1 1 2021-11-15 2 2 2021-11-15 3 1 2021-11-13 4 3 2021-10-13 5 3 2021-09-13 6 2 2021-09-13 View on DB Fiddle I want to delete all records which are older than 14 days, EXCEPT if the user only has records which are older – than keep the