See the line where counter is ZERO?

I'm counting the number of entries in each UNI.
However, I do not get a count to 0

I would like to return to be:
UNI     Entries
POL     1
GYM     3
XXX     0
THE ID TABLE
CREATE TABLE DAN_GR
(ID    VARCHAR2(8),
UNI    VARCHAR2(8)) 

INSERT INTO DAN_GR (ID,UNI) VALUES (1,'POL');
INSERT INTO DAN_GR (ID,UNI) VALUES (2,'GYM');
INSERT INTO DAN_GR (ID,UNI) VALUES (3,'GYM');
INSERT INTO DAN_GR (ID,UNI) VALUES (4,'GYM');
TABLE OF THE BANK
CREATE TABLE DAN_BANK2
(UNI    VARCHAR2(8)) 

INSERT INTO DAN_BANK2 (UNI) VALUES ('POL');
INSERT INTO DAN_BANK2 (UNI) VALUES ('SYM');
INSERT INTO DAN_BANK2 (UNI) VALUES ('XXX');
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi

It looks like a typo in in the sample data; The SYMBOL should have GYM? If so, you get your o/p desired, if not for SYM you will get 0 as count of output.

select uni,
            (
              select count(b.id) --count(b.id)
                from dan_gr b
               where b.uni = a.uni
            ) cnt
  from dan_bank2 a;

UNI      CNT
-------- ----------------------
POL      1
GYM      3
XXX      0      

Tags: Database

Similar Questions

  • See the line between cursors on a graph

    Hello

    I have a graph simple intensity with two sets of sliders on it, called 1 and 2 cursor cursor.  I would like to make a distinction between the sliders so that when the user moves a cursor can see a line superimposed on the graph.  Please see the attachment where 1 cursor is green and cursor 2 is purple.  I used Paint to draw the black line on the graph that I want to add.  Thank you!

    Steve

    Looks like you have a graph of intensity. Easier would be e to use the overlay "draw pictures.

    A simple example is shown here.

    Of course, in your situation, you get the coordinates of the cursor to set the line. For example, use an event 'move cursor' to recalculate.

  • Why SESSION 1 can see the line update?

    --- SESSION 1
    SQL> select * from test;
    ID         NAME
    -----     --------
    1          A
    2          B
    3          C
    SQL> update test set name = 'D' where id = 1;
    1 rows updated
    SQL> 
    SQL> rem  uncommitted this transaction
    SQL>
    SQL> select * from test;
    ID         NAME
    -----     --------
    1          D
    2          B
    3          C
    
    ---- SESSION 2
    SQL>
    SQL> select * from test;
    ID         NAME
    -----     --------
    1          A
    2          B
    3          C
    SQL>
    SQL>
    Question:
    Why SESSION 1 can see the line update? If the transaction had not been validated. before you see the updated row, which the database to submit to win the line?
    I know that SESSION 2 can not see the update line, since it occurs compatible read.

    Lonion wrote:

    --- SESSION 1
    SQL> select * from test;
    ID         NAME
    -----     --------
    1          A
    2          B
    3          C
    SQL> update test set name = 'D' where id = 1;
    1 rows updated
    SQL>
    SQL> rem  uncommitted this transaction
    SQL>
    SQL> select * from test;
    ID         NAME
    -----     --------
    1          D
    2          B
    3          C
    
    ---- SESSION 2
    SQL>
    SQL> select * from test;
    ID         NAME
    -----     --------
    1          A
    2          B
    3          C
    SQL>
    SQL>
    

    Question:
    Why SESSION 1 can see the line update? If the transaction had not been validated. before you see the updated row, which the database to submit to win the line?

    SESSION 1 can see the data that changed since the SESSION 1 fact change.

    I know that SESSION 2 can not see the update line, since it occurs compatible read.

  • Unable to see the lines in tableview

    I tried to add lines to my table dynamically using ObservableList , but it is not visible in the table. I tried to print the data in ObservableList which prints as expected. I even tried to initialize but not visible.

    I used the generator (1.1) of the scene and 7.4 of NetBeans.

    FX:ID is all right, I understand.

    Code snippets

    @FXML

    TableView table < person > final privacy; Nobody is a class with the string two variables firstName and lastName

    @FXML

    Private final TableColumn < person, String > firstNameColumn;

    @FXML

    Private final TableColumn < person, String > lastNameColumn;

    ObservableList < person > special finals;

    ......

    () {

    This.Persons is FXCollections.observableArrayList (new Person ("Lijo", "José"));.

    table = new TableView <>();

    firstNameColumn = new TableColumn ("first name");

    lastNameColumn = new TableColumn ("name");

    firstNameColumn.setCellValueFactory (new PropertyValueFactory < person, String >("firstName"));

    lastNameColumn.setCellValueFactory (new PropertyValueFactory < person, String >("lastName"));

    table.setItems (persons);

    Assert table.getItems () is people;

    ....

    Add Boolean = persons.add (new Person (firstNameField.getText (), lastNameField.getText ()));

    System.out.println ("Adding line..." + add);

    table.setItems (persons);

    ....

    < fx:id TableView = 'table' layoutX "26.0" = on = "14.0" prefHeight = "186,0" prefWidth = "200.00009999999747" >
    < columns >
    < TableColumn id = "firstNameColumn" prefWidth = "100.0" text = "First name" fx:id = "firstNameColumn" / >
    < TableColumn id = "lastNameColumn" prefWidth = "100.0" text = "Last Name" fx:id = "lastNameColumn" / >
    < / columns >
    < / TableView >

    Help, please!

    Thanks in advance

    Lijo Jose

    You have to put the lines

            firstNameColumn.setCellValueFactory( new PropertyValueFactory("firstName"));
            lastNameColumn.setCellValueFactory( new PropertyValueFactory("lastName"));
    

    back in.

    I think that you will need the Person class to be public for these lines work.

  • See the line number error container

    Hello

    I am new to Oracle SQL Developer, I use the version 3.0.0.4 on Windows XP 32 Bit, connected to an Oracle 11 g server.

    I have a statement of "CREATE or REPLACE VIEW FORCE" that shows me an error ("error at line 0 in command: CREATE or REPLACE...") ") when I run it directly in SQL Developer. Unfortunately the error message does not indicate in what line the error occurs (I have activated the display of line numbers).

    Can Developer SQL show me the line number that contains the error?

    Thank you!

    Developer SQL can display the line number, but for some instructions a number of line is not available. CREATE VIEW is one of them.

    Try taking the select statement of create view and it works separately. That should give better diagnoses.

  • on the timeline, I want to be able to see the line of the Red time cursor in all layers

    When I scrub the timeline, it's really useful to be able to see where the time slider is in relation to the layers, how should I do this?

    The update of the corrections after effects CC 2015 (13.5.1) is available, and it solves this problem: http://adobe.ly/1Il5JYe

  • How do I see the lines not loaded by interface errors

    Hello, I have a simple interface, I'm loading of data within the same oracle database from one scheme to another scheme.
    But I see less 3 rows.
    Can some body please advice how to see lines that are not loaded, which justified etc..

    Thank you

    Hello

    You can also see in the ODI opening model--> right click on your target--> Check--> error data store...
    It shows you the E table $ table _ for this specific data store. For each rejected row, you can see all of the columns more the reason for the rejection.

    It will be useful,

    Jerome en

  • How to see the lines of my adpater code SOP in my log files

    Hello
    I'm not able to see my SOP lines in the log files when my adapter is running. Its strange but it's true. I changed the log.properties file to debug for adapters.
    What I have to deal with any other configuration change?
    Please suggest.

    Thank you
    Kalpana.

    Name your Java Code?

    with the superior version of the jdk

    If this most recent version is supported with IOM, then no problem at all. Have you tried with the restart of the server?

  • How to find the lines, where the second column only has a defined value

    I have a table like
    CREATE TABLE MY_MAP
    (
      USERID     NUMBER(10)                    NOT NULL,
      SYSTEMID  NUMBER(10)                    NOT NULL,
    )
    The data in the table can be as below
    INSERT INTO MY_MAP VALUES(1,6);
    INSERT INTO MY_MAP VALUES(2,6);
    INSERT INTO MY_MAP VALUES(3,6);
    INSERT INTO MY_MAP VALUES(1,9);
    INSERT INTO MY_MAP VALUES(2,7);
    Now my requirement is to find all these IDS that are at systemid 6 but not at 9. That is to say

    2.3. [since 1 is both in the 6 and 9], should not be recovered.

    I did two courses is a loop. Can someone give me a single query to do?
    SQL> select * from MY_MAP m
      2  where SYSTEMID=6
      3  and 0=(select count(*) from MY_MAP m2 where m2.USERID=m.USERID and m2.SYSTEMID=9);
    
        USERID   SYSTEMID
    ---------- ----------
             3          6
             2          6
    

    or

    SQL> select * from MY_MAP m
      2  where SYSTEMID=6
      3  and NOT EXISTS (select 1 from MY_MAP m2 where m2.USERID=m.USERID and m2.SYSTEMID=9);
    
        USERID   SYSTEMID
    ---------- ----------
             3          6
             2          6
    

    or

    SQL> select * from MY_MAP m
      2  where SYSTEMID=6
      3  and userid not in (select userid from MY_MAP m2 where m2.SYSTEMID=9);
    
        USERID   SYSTEMID
    ---------- ----------
             3          6
             2          6
    

    or

    SQL> select userid
      2  from MY_MAP
      3  where SYSTEMID in (6,9)
      4  group by userid
      5  having sum(decode(SYSTEMID,9,1,0))=0;
    
        USERID
    ----------
             2
             3
    

    Max
    http://oracleitalia.WordPress.com

    Published by: Massimo Ruocchio March 1, 2010 10:43

  • When I try to go to some French Web sites, I get a warning of the very long drop-down list so long, it is impossible to see the end, where there is a button to click to say OK, I understand, we will see the Web site.

    You need to get to the bottom of this warning, or make them shorten.

    What kind of warning is that?

    It it a warning of this Web site or a warning from Firefox?

    You can usually confirm with enter and Cancel button (cancel) such a window with ESC (Escape).

    You can attach a screenshot?

    Use a type of compressed as PNG or JPG image to save the screenshot and make sure that you do not exceed the maximum file size (1 MB).

  • The lines where him deleted using the databases from backup triggers

    Hi all

    1) CREATE TABLE student1

      (

         no    NUMBER,

         name  VARCHAR2(10 byte),

         marks NUMBER

      )


    I inserted the 10 records (1,2,3...10)


    (2) Created student1_history Table create table student1_history in select * from student1.

    (3) removal of Student 1

    When n = 10

    4) CREATE OR replace TRIGGER after_student1

      AFTER DELETE ON student1

      FOR EACH ROW

    START

    INSERT IN student1_history

                    (no,

                     name ,

                     marks )

        VALUES      (:old. no ,

                     :old . name ,

                     :old . brands of );

    END ;


    (5) select * from student1_history

    no row is returned.


    I have 2 tables as indicated above, I deleted a row in the table of Student 1 and I compile the trigger, I want store the deleted row in the Table student1_history


    Can you please help


    Hello

    Have you tried using the delete trigger BEFORE? Please try if you do not have

    Warm greetings,

    Jjun

  • Where can I see the Sysouts in legend class

    Hello


    IAM get exceptions in the legend class. But Iam not sure about the line where the exception is thrown. So, I added the System.out.println statements inbetween the code. But Iam not getting the sys.outs in the b2b.log file. Please let me know where we can see the sys.outs.



    Thank you
    Geetha S

    Hi Geetha,

    You can check in oracle_home\opmn\logs\ $

    Kind regards
    Dheeraj

  • All of a sudden, I see not the line I draw with the tool pen in Adobe Illustrator?  I don't see points.

    In general, the line drawing shows that I create points with the pen tool.  Suddenly, he stopped it.  I need to see the lines.

    Colleen,

    If I (put) understand, you can enable elastic and here:

    Preferences > anchor and selection display

  • query lines, where...

    I have a table with 3 columns.
    Most of the data are not unique in these 3 columns, the data are same like this:
    1, 2, 3
    1, 2, 3
    1, 2, 3
    4, 5, 6
    4, 5, 6
    4, 5, 6
    4, 5, 6
    6, 7, 7
    6, 7, 8
    7, 7, 8
    7, 6, 7
    As you can see the lines broke no uniqueness:
     
    6, 7, 7--this is ok
    6, 7, 8--this is not ok because we expected 6, 7, 7 at last column again
    7, 7, 8--not ok, because there exist "x, 7, X" combinations more with different x-es.
    7, 6, 7--not ok, we expected 7,7,8
    You can ask about these lines not ok?

    I want to make sure these 3 columns always have in data from the table as
    1, 2, 3
    1, 2, 3
    1, 2, 3
    4, 5, 6
    4, 5, 6
    4, 5, 6
    4, 5, 6
    6, 7, 7
    6, 7, 7
    7, 60, 70

    Something like that, maybe:

    with my_table as (select 1 col1, 2 col2, 3 col3 from dual union all
                      select 1 col1, 2 col2, 3 col3 from dual union all
                      select 1 col1, 2 col2, 3 col3 from dual union all
                      select 4 col1, 5 col2, 6 col3 from dual union all
                      select 4 col1, 5 col2, 6 col3 from dual union all
                      select 4 col1, 5 col2, 6 col3 from dual union all
                      select 4 col1, 5 col2, 6 col3 from dual union all
                      select 6 col1, 7 col2, 7 col3 from dual union all
                      select 6 col1, 7 col2, 8 col3 from dual union all
                      select 7 col1, 7 col2, 8 col3 from dual union all
                      select 7 col1, 6 col2, 7 col3 from dual),
          results as (select col1,
                             col2,
                             col3,
                             count(distinct col2) over (partition by col1) col2_count,
                             count(distinct col3) over (partition by col1) col3_count
                      from   my_table)
    select col1,
           col2,
           col3
    from   results
    where  col2_count > 1
    or     col3_count > 1;
    
          COL1       COL2       COL3
    ---------- ---------- ----------
             6          7          7
             6          7          8
             7          6          7
             7          7          8
    
  • Discover the lines of odd values

    Oracle 11.2.0.1

    Windows

    create table marks)

    number of rollno,

    Number of the object,

    Mark VARCHAR2 (3)

    )

    /

    insert into values of brands (1,1,40);

    insert into values of brands (1,2,35);

    insert into values of brands (1,3,35);

    insert into values of brands (1,4,38);

    insert into values of brands (2,1,10);

    insert into values of marks (2.2, "AB");

    insert into values of brands (2,3,50);

    insert into values of brands (2,4,50);

    insert into values of brands (3,1,55);

    insert into values of brands (3,2,50);

    insert into values of brands (3,3,44);

    insert into values of brands (3,4,4);

    insert into values of brands (4,1,78);

    insert into values of brands (4,2,45);

    insert into values of brands (4,3,84);

    insert into values of marks (4.4, "AB");

    insert into values of marks (5.1, "AB");

    insert into values of marks (5.2, "AB");

    insert into values of brands (5,3,50);

    insert into values of brands (5,4,10);

    > select * from brands;

    ROLLNO TOPIC MAR

    ---------- ---------- ---

    1 1 40

    1 2 35

    1 3 35

    1 4 38

    2-1-10

    2 2 AB

    2 3 50

    2 4 50

    3 1 55

    3 2 50

    44 3 3

    ROLLNO TOPIC MAR

    ---------- ---------- ---

    3 4 4

    4 1 78

    4 2 45

    4 3 84

    4 4 AB

    5 1 AB

    5 2 AB

    5 3 50

    5-4-10

    20 selected lines.

    Power required:

    ROLLNO TOPIC MAR

    ---------- ---------- ---

    2 2 AB

    3 4 4

    4 4 AB

    Business rule:

    We need to identify these roll numbers that are:

    1 AB brands in a single subject.  If the student is AB (Absent) in more than one subject then it is unnecessary.

    2. If there is high marks then also these lines flucuation, as in example above, topic 3 4 roll number, there are only 4 points, while he had good grades in other subjects.

    3. we need extract the lines which the corresponding brand values have values of very high/low i.e. assume a number of specific role is there which have markings about 20-30 but in a subject, he got in circulation 80-90, even as there are a number of role, one subject, he got 10-20 While in the other topic, he got 70-80.

    So I do not know how to identify these rows.  Table have about 15000000 rows.

    Even I don't know what is the technical name for this problem, otherwise I would have to search the forum.

    Is not a student or a home project, is our real time requirement, because usually, when I see something like student, roll number, brand etc. in question, it is considered as project for students.

    Kindly help me.

    Thank you.

    user12050217 wrote:

    Thank you very much for your answer.  As always, it is really useful.

    > Maybe if you mean no more than '1' which would then be ok.

    Yes Sir, that's correct.  We are the lines where the student is absent from more than one topic.

    > You have Roll No. 3 with no AB at all, still rule 1. States 'AB marks in 1.

    Roll No. 3 is necessary output because it has 4 brands in the 4th topic while he got good grades in other subjects.  So that's the big difference with other brands of subject.

    > That means 'large fluctuation '?  There is no logical function for 'high fluctuation.  It must be clearly defined.

    Thank you so much for asking the question.  Fluctuation really means, if there is any subject whose marks are not in the range with another topic then this line is to have high/low difference.  For example in the other topic there are 30,35,40 brands exist but in 4th or any other he got say 3 or 5 or 0, then it is the line that have 'strong fluctuation' it please.

    I think it must be a column in the table that will contain a value from 0 to 9 for lines that have fluctuations.  Then it will be probably easier to select higher values of fluctuation; something like:

    Select * brand where fluctuations = 9; means here are the first few lines required, these lines have a difference higher for a topic to other brands of subject.

    Once again thank you Mr President.

    You have not yet responded to what 'large fluctuation' is.

    Computers do not work on subjectivity, they work on fixed logic.  Tell me that a student who scored 5 in a subject and 20 and 30 on two other subjects has strong fluctuation, but another person may say: "well, the marking is on 500, so 5, 20 and 30 are all a note very low and not really important fluctuation."  That is why we must be clear, what you mean by 'high fluctuation'.  As in my example, I specified it as the ratio between the minimum and maximum marks in less than 20%, but you have to tell us what the actual logic is desired; not a fluffy subjective idea.

    What are the changes from 0 to 9?

    Requirements must be clear in the calculation, not the ambiguous words.

    How about something based on average scores?

    SQL > ed
    A written file afiedt.buf

    1 Select rollno, subject, brands
    2, min_mark, max_mark, round (avg_mark) as avg_mark
    3, case when brands! = "AB" then round(marks/avg_mark,2) 0 otherwise fine as mark_ratio
    4 of)
    5. Select rollno
    6, subject
    7, brands
    8, sum (case when brands = 'AB', then 1 else 0 end) on (rollno partition) as sum_AB
    9, min (case when brands! = 'AB', then other brands trailing null) on (rollno partition) as min_mark
    10, max (case when brands! = 'AB', then other brands trailing null) on (rollno partition) as max_mark
    11, avg (case when brands! = 'AB', then other brands trailing null) on (rollno partition) as avg_mark
    brands m 12
    13       )
    where the 14 sum_AB<=>
    15 * and min_mark/max_mark< 0.8="" --="" 20%+="" difference="" between="" min="" and="" max="">
    SQL > /.
    SUBJECT OF ROLLNO MAR MIN MAX AVG_MARK MARK_RATIO
    ---------- ---------- --- --- --- ---------- ----------
    2 1 10 10 50 37.27
    2 2 10 50 37 AB 0
    2 3 50 10 50 37 1.36


    2 4 50 10 50 37 1.36
    3 1 55 4 55 38 1.44
    3 2 50 4 55 38 1.31
    3          4 4   4   55          38         .1
    3 3 44 4 55 38 1.15
    4 1 78 45 84 69 1.13
    4 2 45 45 84 69.65
    4 3 84 45 84 69 1.22
    4 4 45 84 69 AB 0

    12 selected lines.

    If this isn't what you want, then you need to explain why, clearly and concisely, giving the reasons and logic.

Maybe you are looking for

  • Satellite L25-S1216 drivers

    Help, please. I can't found on this site

  • 5510 - photos print in black/grayscale only

    Photosmart 5510 model B111A, product #CQ176A - photos do not print in color, everything else done. Print pictures of the net or other documents in color, prints hardships are good color. Off in grayscale, uninstalled and reinstalled driver, used doct

  • When you provide audio Windows player

    When u will provide Player audio windows? like winamp/jetaudio? Original title: Media Player

  • dv2810us unbootable

    Last week the computer started to shut down randomly. Now it does not start at all. I'm out of warranty, but other than buying a new computer have no repair option? Also he used to heat too much terribly, could it have fried something internally?

  • Question Manager 5.5 update

    HelloI just installed the 5.5.0 of esxi and vcenter 5.5 complete everything without any problems. When I try to install "plug-in" Update Manager in vsphere client in the plugin Manager wont appear it. In the web client summons "partially" it allows m