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…
Tag: sql
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…
Print Query Result in Console – Robot Framework
I’m using Robot Framework in automations. Now I’m adding SQL Server scripts. In order to facilitate, I would like to make a print of my query (select) to display in the console. How do I do? I tried with the following way, but without success: and The latter prints to the console, but the query se…
Distance between two integer values
is there a simple method to calculate the distance between two values e.g. 10 and 30 which will result to 20. Currently I do it as follows: Answer The Absolute value function does the trick.
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 …
How to determine if lists have at least one same element
Product table contains tags columns: tag columns contain tags separated by semicolon like How to find all rows where tag1 and tag2 columns contain at least one same tag ? For example row should be in result since both columns contain AC Row Should not be in result since all tags are different. Using PostgreSQ…
Entity Relationship Diagram: What is a composite ID .Net Core 6
I have 3 tables in the database and I wanted to know what a composite primary key is. E.g: Table 1 is called superheroes Table 2 is called categories of superheroes and table 3 is called biography of superheroes I want to create an ERD (Entity Relations Diagram) The attribute key is supposed to retrieve the j…
Update Timestamp field with the oldest record of fields within the row or those in a linked table
One table looks like this: TABLE A Nullables a_id not nullable create_timestamp not nullable edit_timestamp nullable closed_timestamp nullable last_mod_timestamp not nullable The other one like this: TABLE B Nullables b_id not nullable table_a_fk not nullable create_timestamp not nullable How would I set last…
Oracle – Count of number of days a value has changed
I have a requirement to write a query in Oracle as shown in the screenshots below. Any help is greatly appreciated. Thanks a lot in advance. Vadi. Table with sample data: Answer This is the solution of your problem