I have this External Table: I created this function to return the week number of the year If I only run the function it tells me that everything has been compiled. But when i run the SELECT it gives me the following error: [I enter the dates like this: ‘2020/01/01’ but sql-developer on the control…
Datatype conversion and calculated column
I have a table with the following structure: Unfortunately, the sale_date is stored as INT and I had to find a way to convert it in quarter (202001 will be Q1). The conversion worked well, but I need to include also some calculated columns based on this conversion. Basically, I need to calculate for Q1 the to…
Binding an unknown number of keywords to a SQL statement with wildcards
I want to bind keywords to a SQL query like this: Note that the number of keywords is NOT predetermined. It is in fact determined by an array which itself is determined by exploding user’s input on space. I am using Laravel 7. So, I am looking for a solution that is consistent with Laravel 7 and PDO. Th…
Why there is no GroupBy clause in internal SQL of Entity Framework linq query?
In documentation of Entity Framework: https://www.entityframeworktutorial.net/querying-entity-graph-in-entity-framework.aspx in section regarding GroupBy we can read that following code: executes internally following SQL: Why there is no GroupBy clause in SQL? If there is no GroupBy clause needed, can’t we ju…
getting the second occurrence of a substring with PatIndex
With this query I get the postal code from an address and it works, but there are some cases where the address number’s length is 5 and so I get this instead of the postal code, is there any chance to …
Difference between Global temporary table (GTT) and collections
I wanted to know the difference between GTT and collections with scenarios where to use GTT and where to use collections. Answer Global Temporary Tables are permanent data structures. We can manipulate data in a GTT using SQL like any other table. What distinguishes them from regular heap tables is: Their dat…
Group rows with a value depending on condition of a different column SQL
I have a list of rows that I need to group by a key and for each group the value of two columns depends on a condition from a different column. For example should become That means, for the value of …
Min & Max date before disruption
In Oracle, I have this table sample : +————+————+————+————+ | EMPLOYEENO | DATE_FROM | DATE_TO | REASON | +————+————+————+———…
Subquery sorted by another table
This is a follow-up question to Get the following record in query. But the task is a bit more complicated. I tried to modify the SQL query but I was not able to fulfill the task. If we have two tables,…
Parent child sql table show as table in php
I have table structure like this: ID Name ParentId ————————- 1 Root 0 2 Business 1 3 Finance 2 4 Stock 3 5 Any 3 6 One 0 7 …