Skip to content

Tag: sql

Making a MySQL COUNT query

after 4 days of tries and researchs over the web I can’t make my wishes working. Any help would be appreciated ! Performed on MYSQL WORKBENCH I got a DB made of 3 tables : user Posts likes username id id id title userId (foreign key from user.id) email content postId (foreign key from posts.id) password…

Using FILTER in IBM DB2 query

I have some queries which works correctly in PostgreSQL but I have to use them to make IBM DB2 queries. It seems like “FILTER” doesn’t work with DB2. My PGSQL query : When I use this with DB2 I get this error : Answer In general, it should be possible to rewrite the FILTER into a CASE statem…

Unable to filter SQL data from last 30 days

I want to collect data from SQL from the last 30 days. This code shows data of all time this shows nothing, instead of showing last 30 days data. All SQL entries were made within the last 30 days. also tried What am I doing wrong here ? Answer Try this: The second doesn’t work because you put GROUP BY

What happens to JOIN if no colums from said table are SELECT-ed?

I am wondering how Oracle, or how DB managers, work through longer scripts and bigger result. I will give an example and some questions below: Does the script run through all tables even though I don’t use them in the SELECT? Generally does this slow down the script execution if it brings back a lot of …