Having this column structure Is it possible to get one-column output with unique values? What I’ve already tried: Union seems doable only in case there are 2 to 3 columns, which is not the case. I’ve found a pivot/unpivot, but I didn’t really grasp it. Answer If you must handle null also, you can do so with the include nulls
Tag: oracle
list records which do not meet a certain criteria in Oracle SQL
I got 3 tables please see the below. Currently, a car has a unique tag assigned to them. I have employees with multiple roles. There are only 3 roles. 1 = Surveyor, 2 = Admin or 3 = Engineer. A car can be assigned to more than one employee. One car can have a surveyor, admin and engineer using it.
Oracle: How to get first returned record and previous record
I want to grab the first returned record and previous record based on a user input date. Example, I put in 7/5/22, and I want to grab that date’s food value and somehow include the record previous to that, so output would be: If I put in 3/16/22, then I want my output to be: My totally wrong code: Answer
How to combine two tables in Oracle SQL on a quantitative base
beacause of a really old db design I need some help. This might be quite simple I’m just not seeing the wood for the trees at the moment. TABLE A: ID 1 2 3 4 5 TABLE B: ID VALUE B 1 10 1 20 2 10 2 20 3 10 3 20 3 30 4 10 TABLE C: ID
Modify generated column in Oracle
I have created a database table in Oracle with an auto generated column: Now I do not need it to be generated automatically. I tried to write: But it did not work. The database gives an error: Can someone please explain how to solve this issue without dropping the column? Answer (There’s no such thing as “PLSQL database”; PL/SQL is
How to search for a name in where Oracle with string and number character
I need to find records in Oracle that have only such record like ‘string|number|number|number|number|number’ for example – ‘A12345’ Answer That’s a letter followed by 5 digits:
Accessing another database user’s tables using Entity Framework
I am trying to access Oracle database using EF Core 6. But the database user given to me doesn’t have any database table. Instead I can see and modify another database user’s tables via SQL DEVELOPER. For example; my user: my user Other user: IFSAPP the following query While returning me a result, does not return any results. With EF
How to find a salary which does not end with Zero
I have been trying to write a query where I need to find a salary which does not end with ZERO My Query : select salary from employees where REGEXP_LIKE (Salary, ‘^(1|2|3|4|5|6|7|8|9)$’); Answer I would just use the modulus here: By definition, the modulus 10 returns the single (final) digit in the salary. Going this route avoids a costly conversion
Oracle SQL conditional operator explanation
Please, may I ask if anyone can explain more on the following oracle sql conditional operator please ? I only have limited oracle sql knowledge that it exclude checking for Sat and sometime for Sunday. Thanks so much! Answer The decode is basically checking the day of the week and returns some magic number = 4, which seems to be
subtract certain date from two dates
Let’s say it is announced that 4 Aug 2022 is a public holiday. I have a table which shows the holiday_start and holiday_end dates. How do I exclude this date “4 Aug 2022” by inputting any date i want (bind variable) and showing it as excluded day eg. leave is from 01-Aug-2022 -> 10-Aug-2022 excluded days= 1 i’ve tried this: