It’s for a school project and I know it may seems basic but I’m wondering how to make a procedure that will verify what time and day it’s actually is like monday and not the date. thank you Answer Please use this – Pls note, you can use ‘DAY’ to get all caps, ‘DayR…
Tag: sql
Is a rollback necessary when insert of a single database record fails?
I am not too familiar with database transactions. I was wondering about a situation where a single record is being inserted into a database. Is a transaction necessary. If so, if the insert of the one record fails, is a rollback necessary? I am asking this related to JDBC but is can be in a general database s…
ORA-00907: missing right parenthesis again
Why? I have used before, I don’t know if it makes a difference but… what’s is wrong with this? Answer multiple issues : Identity column in Oracle are created using generated always as identity Int datatype doesn’t need length. referencing to another table is based on columns , you need…
BigQuery, NULL values when joining transactions and currency exchange tables
I need to convert transactions imports over the last 3 years present in a table to €. To do this, I took a separate table with conversion values. So I need to join this two tables, attach the right conversion rate to the first table. The rates table has two fields (valid_from and valid_to) that contain the ra…
How to deal with JSON column while using GROUP BY
I’m using a query similar to the below one, address is JSON TYPE. But getting below error: I’m trying to get the data of a person who has the max salary for his age and I need to include adress filed which should be JSON So, Is the there any way to achieve this or is this practically possible ?
Get number of days between two dates in SQL
Fleet_ID State ODO_Reading Date_Added 1 F1 State 1 42000 10/01/2021 2 F1 State 1 43100 14/03/2021 3 F1 State 1 43900 26/04/2021 4 F2 State 1 63010 22/02/2021 5 F2 State 1 70800 06/04/2021 6 F3 State 2 17000 03/01/2021 7 F3 State 2 18560 19/03/2021 8 F3 State 2 19695 23/04/2021 Above is a sample database Is it…
Group by the records and that particular group if condition matched then set final result like below
I want to group by the records and that particular group if the condition matched then set final result like below For each group, I want to check the following condition Answer You can use conditional logic: Here is a db<>fiddle.
Follow the connections : recursive query
i have two columns of numbers. the goal is starting from a number f.e. 55, to extract all ‘connected’ numbers (starting with any of those numbers, should yield the same result) in this case all numbers shown here : 55,56,35,69,60,22,47,2,26 I use the following query : but I get back only those bac…
Different performance from SQL Server query from Management Studio vs EF Core 5
I wrote a simple EF Core query that makes a select on a table using some where clause to filter data: start date and finish date between the actual date and a field (DescrizioneCommessa) containing a value. To get the raw SQL I just execute the statement: And the resultant query is: I notice that it takes ver…
SQL error [21000]: ERROR: a subquery used as an expression returned more than one record
The Remesa table has a relationship N to 1 with EnvioRemesa, the issue is that I want to update my delete bit to 1 of the Remesa table, but only update the Remesa that have a EnvioRemesa id = 2. And it is failing me in the query since in the subquery it returns 2 matching records and tries to