Tags:

Recursive SQL query (parent-child) to include total downline records per record


I have a table that has a parent – child structure. I managed to bring this structure sorted by creating a field called “Path” with the first name of the agent, so this query: WITH cte(…

Tags:

Is it possible to iterate over a list of strings and conditionally query an oracle database table based on the current value using SQL or PL/SQL?


Is it possible to query conditionally based on the current value in a list of strings using either SQL or PL/SQL? I am working with an Oracle Database if that helps? Example of desired functionality (…

Tags:

Converting Multiple Rows to Columns


How would I convert rows into columns? In this case, taking the columns of Reason and Weight and expanding the values where more columns are created? The column Reason will only have four values (…

Tags:

Ignore hash character in a query on sqlplus


i’ve launched this query on sql developer without error. insert into COMUNICAZIONI_TEMPLATE (ID, DESCRIZIONE, TESTO_TEMPLATE) values (3, ‘TEMPLATE EMAIL NUOVO DOCUMENTO’, ‘Gentile <…

Tags:

Error ORA-00933,PL/SQL: SQL Statement ignored , PLS-00103 while running this in oracle, How to resolve it?


I am getting errors while running this code Error report – ORA-06550: line 46, column 104: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 43, column 11: PL/SQL: SQL Statement …

Tags:

how can i move column data to another table and set its id to foreign key column in first table? [closed]


I had table application that one of the columns names allowed_command , then I create another table application_command and want to separate allowed_command column and move to second table ‘…

Tags:

Spring Data JPA Native Query N + 1 problem


I’ve run into some code which behaviour is not clear for me. We have first entity: @Data @Entity @Table(name = “Info”) public class Info { @OneToOne @JoinColumn(name = “data_id”) …

Tags:

Pulling different rows based on age in select query


Context I am using Oracle SQL and have data that looks like this. People are asked every year what their favorite movie is and that may update from year to year. Person Date_of_Birth …

Tags:

How to select distinct based on multiple values for one column


I feel this is a very easy task and I am grossly overthinking it. I have looked and looked nothing seems to answer my question. My question is simple, how do I select distinct on one column, based on …

Tags:

Can we use arithmetic operators (+, -. *, or /) on date functions in mysql?


I am learning mysql and I am stuck in the following question. Can we use arithmetic operators (+, -. *, or /) on date functions in mysql? Can someone help me out with it?