Oracle 11g How can I get ALL pet_owners of FURRRY and SCALY and only earthworms and slugs ? Answer You want either of the two conditions to be met, so you need OR:
Tag: oracle11g
Oracle Hierarchical Query at depth level
I have a requirement to build a table from a hierarchical table. Table structure as below: emp_hier table: emp_id supervisorId 100 null 1 100 2 1 3 2 New table: I have to write a select query on the emp_heir table and the selected data should look like this: sel_emp_id rel_emp_id relation depth_lvl 100 100 self 0 100 1 My
Transpose rows to columns using multiple pivots
I am trying to transpose rows to columns without any luck . What I have now WEEK_NUMBER VAL9 VAL4 VAL5 VAL7 45 63.27% 28.58% 7.92% 0.23% 52 65.66% 26.16% 7.80% 0.38% 50 90.97% 8.45% 0.29% 0.29% 46 82.49% 12.43% 3.01% 2.06% 47 66.33% 29.53% 3.77% 0.36% 51 65.36% 31.83% 2.69% 0.11% 49 61.88% 28.29% 9.46% 0.37% 44 45.34% 45.55% 8.45%
Is there a way to group values getting only the ones that verifies certain condition?
I’m trying to write a query in Oracle SQL that aggregates values by some ids, where I have the following table as an input: ID SOME_DATE RANK_POSITION 301 20211201 1 301 20211202 2 301 20211203 3 649 20211201 1 649 20211202 2 649 20211206 3 649 20211208 4 649 20211211 5 758 20211212 1 758 20211222 2 And y want
Multiple tables joined to a table via single column
I am trying to create query, on below scenario. with my skills I am able to join Table A,A1,B and A,A1,C and A,A1,D individually and union them. Is there any better way to achieve same. I am using Oracle as Database. Answer It all depends on what they mean and if you need to know the columns the values are
How add more rows when find string in column Oracle
Would it be possible to add more rows base on Keyword string in SQL ? table A table B Example: Output of the SQL should be – How to find string with keyword ‘FamilyCare’ in PromotionName of table A base on promotion_code of table B? If it exist it will add more rows in output Any help with the SQL?
how to using BETWEEN in CASE
so I want to make a case where if between the year of acceptance and the current year (sysdate) it is 1 to 5 it will be rank 1 and 6 to 10 rank 2 I using the code like this But error it say ‘missing keyword’ in the when between 1 and 5 where EMPLOYEES table contains EMPLOYEE_ID,FIRST_NAME,HIRE_DATE columns
Combine 2 similar update queries into one query
Is there a way by which I can combine the above two queries (updating the same table) into one single query? Answer You may use a case expression to achieve this eg.
All tables consisting of numbers less than a fixed number
I am trying to find out all the tables where table names consist of numbers less than a fixed number 16284961 at the end preceded by an underscore for example LOG_16282961. Sample User_segments table: Expected Output: Query: Using above query, although I am getting my result but additionally it also includes following tables which are not required in my output:
Change + ordered to + leading
I’m trying try to find the most selective criteria to start joining in SQL. I tried this: But this + ordered is deprecated. How I can implement this query using + leading? Answer Use the leading hint and put the table aliases between parentheses in the order you want the database to join them, for example: This would tell the