I have a table where I have to insert values in Final_value column Explanation of the task First value of the Final_value column will be = 1st value of column1 i.e 5.5 From the 2nd row we will check if column2 is Not Null a) if TRUE , then formula would be previous Final_value column* ( current column1 value/previous Column1
Tag: oracle
How to find the degree of connection in a social network using recursion
Imagine, you are looking at a social network graph of millions of users. Imagine Facebook users who are in different Facebook Groups. Let me give the following example: We start with Jeff. Jeff has a degree of connection with himself of 0. Rohit is in the same Facebook group as Jeff, so his degree of connection with Jeff is 1.
SQL: How to COUNT the number of keys that appear in a certain number of rows
I have the following two SQL tables dog and toy: dog id gender 1 2 2 2 3 2 4 1 toy toy_id dog_id 1 1 1 2 2 1 2 2 We want to find out how many female dogs have a certain 0 toys, 1 toy, 2 toys… A value of 2 in the gender column indicates the
Getting not valid month in Oracle sql
I have a table called Transactions that has a column called trans_date. I am just trying to do a simple query in the SQL*Plus command window The query is When I run this query I get not valid month and there is a little * under trans_date. Most of what I have read suggests the query is right but I
Delete node when child have a certain value is found
I intend to remove a node whenever I find the unit_qty tag with the value equal to 0.0000. For example considering that the message below is called MESSAGE_DATA: the purpose of message_data is to return the following: I’ve already tried the following options: I don’t know if I’m looking up the tag wrong but I’ve tried it with several formats
Is there any way we can emulate the way of using :old and :new of row triggers in statement triggers in PL/SQL
Good Day Buddies! So, here is my Question, it says – Write a update, delete trigger on clientmstr table. The System should keep track of the records that ARE BEING updated or deleted. The old value of updated or deleted records should be added in audit_trade table. (Separate implementation using both row and statement triggers) And my solution looks like
Generate Result based on max count in secondary column after a join
I have two tables which have a common key between them, and quite a lot of other important infos ; for the sake of simplicity i will be using Combination A and Combination B. When a combination is met, whichever table has the maximum number of records should be the source where i collect the information ; in this case
Oracle Case Statement and efficency
I have a piece of my Oracle Query i need to optimize a little line.quantity comes out from other part o query, for this example is not needed i think. I would like to calculate only once SUM(dnl.quantity) instead ad every iteraciotn, somethink like But obviously this give error at the second and 3rd WHEN Answer You are over-optimizing. The
Oracle SQL return column calculated from existing columns
I have the above SQL query which returns the columns name, X and Y. I would like to return one more column (lets call it Z) which gives the value of X/Y but not too sure how to do this – I tried writing (X/Y) Z but no luck – any suggestions? Answer Use CTE
Column containing the product of elements in a second column, sorted by group
I have the following SQL script, , which yields, I wish to create a column, Product, that contains the product of Numbers on each date within the same BM group: To clarify, for BM =’AA’ the product should be 1*2*3*4*5=120. Thank you in advance! Best regards, Answer There isn’t a built-in product function; but you could use the exp/ln technique