place a select query calculation in a different column in the same table

How can I put my calculation result in a column named within the same table?

I have a table called: dgpercentagedatachart

I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage

In the query, I gave the result the Alias of the cal

What I want is to put this result in my application or my calculation (in percentage) in my column "percent" on my table of dgpercentagedatachart vacuum.

How can I configure this syntax?

This is the select query, I came with:

Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.

100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal

of dgpercentagedatachart;

Here are the results:

CAL lowestfeederrating Totalcecrating

8,978 7.48166666666666666666666666666666666667 120

30.951 25.7925 120

5.04                         120                          4.2

Hello

2685870 wrote:

How can I put my calculation result in a column named within the same table?

I have a table called: dgpercentagedatachart

I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage

In the query, I gave the result the Alias of the cal

What I want is to put this result in my application or my calculation (in percentage) in my empty column '%' on my table of dgpercentagedatachart .

How can I configure this syntax?

This is the select query, I came with:

Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.

100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal

of dgpercentagedatachart;

Here are the results:

CAL lowestfeederrating Totalcecrating

8,978 7.48166666666666666666666666666666666667 120

30.951 25.7925 120

5.04                         120                          4.2

To change an existing column in a table, you can use the UPDATE or MERGE, instructions like this:

UPDATE dgpercentagedatachart

Percentage of VALUE = 100,00 * totalcecrating

/ lowestfeederrating

;

Noramlly, tables is not redundant columns like this.  If percent can always be calculated from other columns, then it is probably better to calculate at run time and store it in the database, where you will have to be updated each time the columns it depends on change.  You can use a view to avoid having to encode them the calculation.

If you really don't want a column that can be calculated in the same lines other columns, then use a virtual column (if you use Oracle 11 or higher).

I hope that answers your question.

If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.

If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.

Explain, using specific examples, how you get these results from these data.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: Re: 2. How can I ask a question on the forums?

Tags: Database

Similar Questions

  • With the help of table 'helper' to fill the 2 different columns in the same table

    I have a table that contains two columns that use abbreviations that I want to join to another table "assistance" that develops on what mean these abbreviations. I have my query to display the full name of these abbreviations, rather than the abbreviated name.

    For example,.

    Table 1

    Name acronym
    ====== ======
    MY Monday
    KILL Tuesday
    WEDNESDAY Wednesday


    Table 2

    Entry day due date
    ====== ======
    LUN MAR
    MAR SEA
    SEA OF LUN


    I want to create a query that will show you:

    Entry day due date
    ====== ======
    Monday Tuesday
    Tuesday, Wednesday
    Wednesday Monday

    I can get it to map a column, but not both. Any help?

    Assuming that you really do need the table of the acronym (i.e. Oracle includes functions to translate date abbreviations).

    SELECT a.full_name entry_date,
           b.full_name due_date
      FROM table1 a,
           table1 b,
           table2 c
     WHERE a.acronym = c.entry_day
       AND b.acronym = c.entry_day
    

    Justin

  • Question: Is foreign key references to a different column in the same table

    Hello

    I'm not grasp this concept. Would you be able to provide the logic how and why you need to create a foreign key that references a column of the same table?

    For example, referencing the schema, SupervisorNo @ here is a FOREIGN KEY to the "EmpNo" column in the same table.

    EMPLOYEE (EmpNo, title, Fname, Lname, phone, Email, date of birth, sex, salary, HireDate, OutNo, SupervisorNo @)


    Why would you want to do this and how can it be used? If you are filling out the data in the table, and this constraint is enabled, you will not be able to load whatever it is because the "EmpNo" column will be empty.


    Any input you can provide me with this would be greatly appreciated. Thank you!



    His name

    Self-referential integrity constraints

    Lets say that we have the table emp with emp_no and mgr_no columns.

    Now all managers should also be an employee too. How can I check this when inserting data into this table? I applied auto integrity constraint. It would help me to make sure no handler (doesn't mean no mgr_no) must be registered if this Manager is not an employee of this organization. Which means, I won't be able to enter any mgr_no in the column until and unless that the same employee also is an employee (emp_no from the same table).

    Check the link as well below.

    Data integrity

    Thank you

    Ishan

  • How to take a column of duplicate names and fill a different column with the same names, excluding duplicates?

    How to take a column of duplicate names and fill a different column with the same names, excluding duplicates?

    I find easier to use this copy separate Automator Service (download Dropbox).

    To install in your numbers > Services, double-click menu just the package downloaded .workflow and if necessary give permissions in system preferences > security & privacy.

    To use, just:

    1. Select the cells in the column with duplicate names.
    2. Choose separate copy in numbers > Services menu.
    3. Click once in the upper cell where you want the deduplicated values appear.
    4. Command-v to paste.

    SG

  • Is it possible to put different movieclips in the same table?

    Hello. I have two different balls movieclips. I want to put the two in the table with a single bullet, but it seems that all the second movieclip instances are not controlled by bullet_ary [i]

    Yes, you can add more than one:

    var mcA:Arrray = [];

    for (var i: int = 0; i<>
    mcA.push (new MovieClip());

    }

  • Using different filters on the same measure in single result table (view)

    I have a table of twelve columns, each column with different filters tailor-made same table actually. Say a filter column (several people existing on 01/01/2003) comes from people dimension (date_of_birth < = January 1, 2003 ""). Two filter in column b (number of people living in Bucharest between 1 January 2004 and 1 January 2006 "") is (between 2004 and 2006 date_of_birth) etc.
    How do I use column a & column b in the same table of results (view)? I need the different filters on the same table.

    Thank you!

    Published by: seiciu on March 27, 2010 08:51

    Hello
    This filter clause works.
    filter (using Date = current_date)
    filter (using Date = date'2010-01-01')
    filter (measures using the year between 2004 and 2006)
    Concerning

  • Different guests on the same column

    Gurus:

    I have a requirement where we need to have Date guests separated for 4 different promotions.
    Now, I was thinking about the presentation configuration variable, but then it does not work with 'Between' condition.

    So how can I compare a fact for 4 different promotions (Sun) with 4 dates different (Sun) in the same report?

    I don't know if this is possible.
    Please help me.
    Thank you.

    Vinay

    I'm not sure that I understand your question completely, but it seems you need to get the same value (say sale) measure for 4 different dates in the same table.

    My suggestions would be to create dims again and use union all with each union report report led at different times of Sun.

  • Sinlge select query in the diff for the same table (same Structure) diagrams

    Scenario:

    Table XYZ is created in detail a.
    After a year, the old data of the previous year could be moved to another schema. However in the other schema of the same table name would be used.

    For example

    A schema contains XYZ table with data from the year 2012
    Schema B contains XYZ table with data for the year 2011
    Table XYZ in the two schemas have an identical structure.

    So we can draw a single select query to read the data from the tables in an effective way.
    For example select * from XYZ so including date between October 15, 2011 to March 15, 2012.
    However, the data resides in 2 different schema altogether.


    Creating a view is an option.
    But my problem, there are ORM (Hibernate or Eclipse Top Link) layer between the application and the database.
    If the queries would be constituted by the ORM layer and are not generated by hand.
    So I can't use the view.
    So is there any option that would allow me to use only query on different scheme?

    970773 wrote:
    Scenario:

    Table XYZ is created in detail a.
    After a year, the old data of the previous year could be moved to another schema. However in the other schema of the same table name would be used.

    For example

    A schema contains XYZ table with data from the year 2012
    Schema B contains XYZ table with data for the year 2011
    Table XYZ in the two schemas have an identical structure.

    So we can draw a single select query to read the data from the tables in an effective way.
    For example select * from XYZ so including date between October 15, 2011 to March 15, 2012.
    However, the data resides in 2 different schema altogether.

    Creating a view is an option.
    But my problem, there are ORM (Hibernate or Eclipse Top Link) layer between the application and the database.
    If the queries would be constituted by the ORM layer and are not generated by hand.
    So I can't use the view.

    Why not make the ORM as below?

    SELECT * FROM VIEW_BOTH;
    -VIEW_BOTH is a real VIEW of Oracle

  • Insert select on the same table: possible without side effects?

    I have a very large table T1 containing millions of records. I need to treat its lines and create a few new lines based on selection.

    Table T1 contains events and one of them, with the code 100, is created by the further development of other events inside the table.

    My code is as follows:

    insert /*+append */ into T1 (code,...) values (100, c1,c2,...)
    select c1,c2... from T1 where (code=20 or code=10) and <other conditions>...
    
    

    as you can see I'm extract T1 lines to insert again in T1 with a different code and I use the direct path in order to get good performance.

    My fear is: choose is made from the same table I risk data loss? In general it is a good practice? Or is it better to create another table?

    Hello

    No I don't think that there may be loss of data. But that may depend on the behavior of the application and your where clause.

    I will explain how it is treated, so you can see if it's ok:

    1. the table is locked because of the insert add, (as)

    2 lines are read by select and make compatible from the State that was at the beginning of the query - 1.

    3 rows are inserted at the end, after the high-water line

    4 columns for new lines are sorted to be merged in the index

    5. high watermark is adjusted - visible new lines and lock is released

    Note that 2. and 3. occur at the same time: rows are inserted all read.

    Note that anyone can choose in the table during the operation - they see the changes committed only - if the State 1.

    all other DML are waiting for the lock being released, and will see new ranks and then

    If you have things that prevent the direct-path insert, append the hint will be ignored. So, if you must rely on close to 1. then the best lock explicitly with table lock. But I don't think that you need.

    Kind regards

    Franck.

  • Lightroom can open 2 different photos at the same time display side by side?

    or if not, is there another program that can do this?

    What is behind this survey is the fact that I have to directly view and compare the 2 pictures of the bird even close together in the same time and location (in a level of detail) to determine that it was certainly better.

    Authorization of repairs to my most recent goal that is at stake here that I must first demonstrate the mfgr that lens is below standards and needs attention.

    I want to compare a picture of the bird in question with the above goal and one I know to be reliable strong.

    Please help in this mission.

    Thank you.

    HI Nikon D90 gent II,.

    YES - Lightroom TO compare 2 different photos at the same time. It also allows you to zoom in to areas and match zoom.

    In the LIBRARY module, make sure that your toolbar is open under the grate.

    You can press "T" on the keyboard to make it visible.

    Select both images and click on the area of comparison of X Y. My arrow in red below.

    The two images appears then side by side with a labeled as the "Select" and the other marked 'candidate '.

    You can click and drag the Zoom slider that appears now on the toolbar to zoom for both images.

    To align the images, you can click the lock in the toolbar to unlock

    Click on and drag on the image to align with the other, then click on the padlock to lock in place.

    Then you can zoom in easily all over the two images by using the Zoom slider at the same time for comparison.

    In fact, you can click the button of "Carousel", the one with the three grey squares to the right of the X Y button on the toolbar and to compare the images of 3 or more.

    TO remove an image, simply click on the X in the corner of the image, and it will be removed at the carousel compared so you can then get more unless you images.

  • How to export a series of images in different proportions at the same height

    How to export a series of images in different proportions at the same height?

    I have a slider callery for my Web site. all images must be of 750 Pixels high, that width is not serious.  I have a mixture of images of pandscap and protraite square, I can do the thing as an export or what I have to do it twice?  Once for the long edge and once for shooting edge?

    Thank you

    Yes, you can, but there is a thing for her.

    In the export as dialog boxSelect Widdth & height.

    Then enter 750 pixels in height.

    Place the cursor in the width field behind all the numbers that appear there and with the BACKSPACE key delete the numbers. If you enter "0" it will not accept that. But she accepts when you remove just the field for the width with the BACKSPACE key. The field width will now be just empty.

    When you export then images will have a height of 750 pixels and width will fall variously according to height then / ratio.

    Or alternatively, you can enter 7.5 "in height at a resolution of 100 dpi.

  • Different version of the same form

    I have 3 different versions of the same form that I need to turn it into editable PDF files. Each form has the same fields, placed in the same place, however the logo and the language is different on PDF files. I already have a modifiable form and it was VERY time consuming, there are a lot of fields and check boxes throughout the document.

    Is it possible to copy and paste (drag / move) the editable fields from the form for the 2 other versions? Or do I have to create fields of each on individually? One took me several hours to complete, and I'm not anxious to do this 2 more times.

    For any help or suggestion would be greatly appreciated!

    All you have to do is to open the document that contains the fields, and then select "Document > replace Pages" for updating the content of the underlying page with pages to a new document that you created in the other language. The fields, links, etc will be kept.

  • Cropping multiple pictures on different pages at the same time

    Can I culture several images on different pages at the same time. In my french version of software Photos 1.5, this option is called "the photo to the frame adapter". I'm able to select this image of an option at a time, but could not find a way to make the entire book in one click.

    No there is no functionality like this in Photos

    You can ask Apple to add the - http://www.apple.com/feedback/photos.html

    LN

  • How to display on my screen 2 different applications at the same time?

    How to display on my screen 2 different applications at the same time?

    Hello

    The best place to ask would be the forums for answers corresponding to your version of Windows.

    Answers - Windows Forums
    http://answers.Microsoft.com/en-us/Windows

    =====================

    If you have Windows 7 with Aero - click with the right button on the taskbar at the bottom of the screen and click on 'show windows '.
    Side by Side.

    For all versions of Windows:

    You could also reduce less than full screen using the small box to the left of the red X at the top right
    and then resizing windows as you want.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • different values on the same grouping column

    Hi all

    I have a requirement to find different recordings of the same grouping columns have value different values in the columns, for example:

    WITH

    Data (G1, COL)

    AS

    (

    SELECT 'A', '456' FROM dual UNION ALL

    SELECT 'A', '345' FROM dual UNION ALL

    SELECT 'A', ' ' FROM dual UNION ALL

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "" the DOUBLE

    )

    Select g1, pass data

    Ideally for G1 = A, the NECK should have that a single value across records ' 456 'or ' 345'. So I need to check the values in NOT NULL of the COL where, for any value of G1, we have different values of the colonel G1 = 'B' is perfectly fine, so I don't need. G1 = C is good too and I'm not worried about it. I only need these entries when the neck was non-empty value / NULL not different for the same value of G1.

    So expected out put is

    Capture.PNG

    WITH

    Data (G1, COL)

    AS

    (

    SELECT 'A', '456' FROM dual UNION ALL

    SELECT 'A', '345' FROM dual UNION ALL

    SELECT 'A', "double UNION ALL

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT ' 'B, 123' FROM dual UNION ALL.

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "789' FROM dual UNION ALL

    SELECT 'C', "the DOUBLE

    )

    Select g1,

    Col

    de)

    Select g1,

    Col,

    Count (distinct trim (col)) at the NTC (g1 partition)

    from the data

    )

    where NTC! = 1

    and trim (col) is not null

    /

    G COL. NO.
    - ---
    A 345
    A 456

    SQL >

    SY.

Maybe you are looking for