Disease analysis problem in database

hy I am facing a problem of generating reports of diffenent diseases based on different criteria my problem is that I have four tables
Patients (patient_id,name,gender,DOB) with data
(1,jon,male,12-FEB-1980)
(2,mical,male,12-FEB-1950)
(3,sunita,female,12-FEB-1970)
(4,shakira,female,12-FEB-1960)
visits(visit_id,patient_id,visit_date) with data
(1,1,12-FEB-2011)
(2,1,12-FEB-2001)
(3,1,12-FEB-2010)
(4,2,12-FEB-2011)
(5,2,12-FEB-2009)
(5,3,12-FEB-2008)
(6,3,12-FEB-2007)
(7,4,12-FEB-2011)
patient_disease_history(history_id,disease_id,visit_id) with data
(1,F00,1)
(2,F00,1)
(3,F01,1)
(4,F01,1)
(5,F02,1)
(6,F00,2)
(7,F01,2)
(8,F01.0,3)
(9,F02.0,3)
(10,F00.1,4)
(11,F00,4)
(12,F04,5)
(13,F04,5)
(14,F03.0,6)
(15,F03.1,6)
(16,F03.2,7)
(17,F00.0,7)
(18,F02.0,7)
(19,F03.1,7)
diseases(disease_id,title,base_category) HAVING data like
(F001,Cancer,'')
(F00,brest cancer,F001)
(F00.0,left brest cancer,F00)
(F00.1,right brest cancer,F00)
(F01,chest cancer,F001)
(F01.0,inner chest cancer,F01)
(F01.1,outer cancer,F01)
(F02,leg cancer,F001)
(F02.0,left lef cancer,F02)
(F02.2,right lef cancer,F02)
(F03,arm cancer,F001)
(F03.0,left arm cancer,F03)
(F03.1,right arm cancer,F03)
(F03.2,center finger cancer,F03)
(F04, ear cancer,F001)
(F002, TB,'')
(F003, AIDS,'')
1) Now my first requirement is to find total no of patients under F001 result should be collection of all the diseases under that disease
2) second find total no of male PATIENTS under F001
3) find total no of patients under F001 from visit_date 1-FEB-1949 to 1-FEB-1990
4) find total no of female patients under F001 from visit_date 1-FEB-1949 to 1-FEB-1990
5) find total no of patients under F03 from visit_date 1-FEB-1949 to 1-FEB-1990 whose DOB is 12-FEB-1980
solve these problems either using sub queries or hierarical queries
only write queries with results of each query

Homework?
Anyway you should ask this in the database forum {forum:id=75}
Timo

Similar Messages

  • Interactive report performance problem over database link - Oracle Gateway

    Hello all;
    This is regarding a thread Interactive report performance problem over database link that was posted by Samo.
    The issue that I am facing is when I use Oracle function like (apex_item.check_box) the query slow down by 45 seconds.
    query like this: (due to sensitivity issue, I can not disclose real table name)
    SELECT apex_item.checkbox(1,b.col3)
    , a.col1
    , a.col2
    FROM table_one a
    , table_two b
    WHERE a.col3 = 12345
    AND a.col4 = 100
    AND b.col5 = a.col5
    table_one and table_two are remote tables (non-oracle) which are connected using Oracle Gateway.
    Now if I run above queries without apex_item.checkbox function the query return or response is less than a second but if I have apex_item.checkbox then the query run more than 30 seconds. I have resolved the issues by creating a collection but it’s not a good practice.
    I would like to get ideas from people how to resolve or speed-up the query?
    Any idea how to use sub-factoring for the above scenario? Or others method (creating view or materialized view are not an option).
    Thank you.
    Shaun S.

    Hi Shaun
    Okay, I have a million questions (could you tell me if both tables are from the same remote source, it looks like they're possibly not?), but let's just try some things first.
    By now you should understand the idea of what I termed 'sub-factoring' in a previous post. This is to do with using the WITH blah AS (SELECT... syntax. Now in most circumstances this 'materialises' the results of the inner select statement. This means that we 'get' the results then do something with them afterwards. It's a handy trick when dealing with remote sites as sometimes you want the remote database to do the work. The reason that I ask you to use the MATERIALIZE hint for testing is just to force this, in 99.99% of cases this can be removed later. Using the WITH statement is also handled differently to inline view like SELECT * FROM (SELECT... but the same result can be mimicked with a NO_MERGE hint.
    Looking at your case I would be interested to see what the explain plan and results would be for something like the following two statements (sorry - you're going have to check them, it's late!)
    WITH a AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_one),
    b AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_two),
    sourceqry AS
    (SELECT  b.col3 x
           , a.col1 y
           , a.col2 z
    FROM table_one a
        , table_two b
    WHERE a.col3 = 12345
    AND   a.col4 = 100
    AND   b.col5 = a.col5)
    SELECT apex_item.checkbox(1,x), y , z
    FROM sourceqry
    WITH a AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_one),
    b AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_two)
    SELECT  apex_item.checkbox(1,x), y , z
    FROM table_one a
        , table_two b
    WHERE a.col3 = 12345
    AND   a.col4 = 100
    AND   b.col5 = a.col5If the remote tables are at the same site, then you should have the same results. If they aren't you should get the same results but different to the original query.
    We aren't being told the real cardinality of the inners select here so the explain plan is distorted (this is normal for queries on remote and especially non-oracle sites). This hinders tuning normally but I don't think this is your problem at all. How many distinct values do you normally get of the column aliased 'x' and how many rows are normally returned in total? Also how are you testing response times, in APEX, SQL Developer, Toad SQLplus etc?
    Sorry for all the questions but it helps to answer the question, if I can.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)

  • Check "Problem: Oracle Database 10g Release 2 can only be installed in new

    Hi All
    Installing 10g software on AIX Box in /oracle/oraHome2,where oracle9i is already installed in /oracle/oraHome1 and oracle inventory is in /oracle/inventory
    In product specific prerequisite screen I am getting the
    check:Oracle Home incompatibilties is failed I am getting the error
    Check complete. The overall result of this check is: Passed
    =======================================================================
    Checking for Oracle Home incompatibilities ....
    Actual Result: Oracle9i Database 9.2.0.1.0
    Check complete. The overall result of this check is: Failed <<<<
    Problem: Oracle Database 10g Release 2 can only be installed in a new Oracle Home
    Recommendation: Choose a new Oracle Home for installing this product
    though I am installing it in different oracle homes why i am getting this error?
    Is it because 10g installation is picking the same oracle inventory /oracle/inventory
    do i need to make different oracle inventory for different oracle homes???????plz confirm..is thats the reason i am getting this error??????
    Thanks inadvance
    Gagan

    I figure out you are trying to install 10gR2 on top of an existing 9iR2 Oracle Home. This is corrected at the Path definition window. Most probably you just click on the <Next> and by default the 9iR2 Oracle Home was selected. You must define a new oracle home for the 10gR2 install.
    ~ Madrid

  • Sales analysis problem

    sales analysis problem
    scenario: there are many plants and customers, the relationship between them is n:n, and every
    customer has a classification.
    my question is how to calculate the number of the plant that sold to one classification of the
    customer in BW.
    for example;
    plant: 1000, 1001, 1002
    customer: 2000, 2001, 2002
    classification: A, B
    customer's classification: 2000:A, 2001:A, 2002:B
    transactions:
    plant->customer
    1000 ->2000:A
    1000 ->2001:A
    1001 ->2000:A
    1001 ->2002:B
    1002 ->2002:B
    so the result is : the number of plant that sold to customer classification A is 2;sold to
    customer classification B is 2;
    how to carry out it in bw with a cube, please help help me solve the problem, thank you very
    much!

    Wilfred,
    You should create a message with SAP Support on this issue.
    Eddy

  • Problem with database schema objects in the entity object wizard

    Hi All,
    When creating a new entity object, I am facing a problem with database schema objects in the entity object wizard, database schema objects (check boxes for tables,synonyms...) are disabled. Actually I am using a synonym but I am not able to select the synonym check box.
    Can any of you folks tell me how to enable the database schema objects (check boxes for tables,synonyms...).
    Thanks in Advance.
    Raja.M

    Make sure your using rite version of jdeveloper..
    Make sure your using apps schema and check whether your able perform DML operations in the schema vis sql developer.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                           

  • Problem in Database

    Dear all
    I am facing a problem in database
    well
    whenever a insert statement is fired the system is hangout
    and
    in server when some inactive sessions are killed the statement gets completed
    and always have to do that
    whenever a insert statement is fired
    how to solve this problem

    I think you have a powerful lock problem in your database. Can you try to look some dictionary views related to locks before and during this special insert??

  • Problem connecting DataBase Link from windows oracle to oracle on Linux

    I'm facing a problem with database links from windows oracle to Oracle hosted on Linux server.
    I'm able to successfully create the Database Link using the following query on oracle database hosted on a windows server
    CREATE DATABASE LINK SampleDB
    CONNECT TO myuser IDENTIFIED BY password
    USING 'sample';
    The tns names entry on windows for database in Linux server is as follows
    DSOFT =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = sample)
    But while executing the query "select count(*) from doctor@SampleDB;" in sql developer on windows, I'm getting the following error
    SQL Error: ORA-12154: TNS:could not resolve the connect identifier specified
    12154. 00000 - "TNS:could not resolve the connect identifier specified"
    *Cause:    A connection to a database or other service was requested using
    a connect identifier, and the connect identifier specified could not
    be resolved into a connect descriptor using one of the naming methods
    configured. For example, if the type of connect identifier used was a
    net service name then the net service name could not be found in a
    naming method repository, or the repository could not be
    located or reached.
    Using the above tns entries, i'm successfully able to connect to the database in Linux server through sql developer installed on the windows machine. Then why i'm getting this error while executing the query on Database Link?. Can any one help me?

    1005745 wrote:
    I'm facing a problem with database links from windows oracle to Oracle hosted on Linux server.
    I'm able to successfully create the Database Link using the following query on oracle database hosted on a windows server
    CREATE DATABASE LINK SampleDB
    CONNECT TO myuser IDENTIFIED BY password
    USING 'sample';
    The tns names entry on windows for database in Linux server is as follows
    DSOFT =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = sample)
    But while executing the query "select count(*) from doctor@SampleDB;" in sql developer on windows, I'm getting the following error
    SQL Error: ORA-12154: TNS:could not resolve the connect identifier specified
    12154. 00000 - "TNS:could not resolve the connect identifier specified"
    *Cause:    A connection to a database or other service was requested using
    a connect identifier, and the connect identifier specified could not
    be resolved into a connect descriptor using one of the naming methods
    configured. For example, if the type of connect identifier used was a
    net service name then the net service name could not be found in a
    naming method repository, or the repository could not be
    located or reached.
    Using the above tns entries, i'm successfully able to connect to the database in Linux server through sql developer installed on the windows machine. Then why i'm getting this error while executing the query on Database Link?. Can any one help me?A database link is acting as a client to the target, remote database in exactly the same fashion and using exactly the same tns infrastructure as any other client trying to connect to that remote database. your ORA-12154 when querying a db link means exactly the same as if you had gotten it trying to connect with sqlplus, from the same server. Check the link SB provided. Keep in mind that the tnsnames file of concern is the one on the source database server.

  • Problem with database connectivity

    Hi guys,
    I'm having a problem with database connectivity . I'm using the mySQL database & org.gjt.mm.mysql driver.
    I've kept the org folder under the directory where the Database.java program is residing .
    My program is as follows:
    import java.sql.*;
    public class Database
         Connection con;
         public void connect()
              System.out.println("In connect.");
         public Connection connectDB(String username,String password,String database)
              try
                   Class.forName("org.gjt.mm.mysql.jdbc.Driver");
                   String url="jdbc:mysql:"+database;
                   con=DriverManager.getConnection(url,username,password);
              catch(SQLException e)
                   System.out.println("SQL Exception caught:"+e);     
              catch(Exception e)
                   System.out.println("Exception e caught:"+e);     
              return con;
         public static void main(String args[])
              try
              Connection c;
              Database db=new Database();
              c=db.connectDB("root","","//192.168.0.2/squid");
              System.out.println("Connection created.");
              c.close();
              catch(Exception e)
                   System.out.println("Exception caught:"+e);     
    It gets compiled but gives the following error when run.
    Exception e caught:java.lang.ClassNotFoundException: org.gjt.mm.mysql.jdbc.Driver
    Connection created.
    Exception caught:java.lang.NullPointerException
    I don't know why the class is not found.Pl . help me rectify my mistake.Is there any other path to be set?
    Thanks.

    You need to run it with the JDBC driver in the classpath
    java -classpath .;[mySqlJdbcDriver.jar] Database

  • Strange problem with Database LInk

    Hi Everyone,
    I have strange problem with Database Link in Oracle 11g Express Edition;
    There are two computers: computer-server and computer-client. Tnsnames.ora are the same on both computers ie.
    CT =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = krzysztof)(PORT = 1521))
    (CONNECT_DATA = (SERVICE_NAME = XE)
    I created database link :
    Create database link zdalny
    Connect to <user_id> identified by <password>
    using ‘CT’;
    Client can’t connect with server when I am using above command. But when I change “using” for using ‘krzysztof:1521’ or using ‘krzysztof’ or using ‘server IP:1521’ – everything is ok.
    Why I am asking. Because in all materials which I am reading about Oracle command with using ‘CT’ should be working correct. But there is not. Do you know, why?
    Thanks in advance and apologize for my English.
    Rgds
    Krzysztof

    Krzysztof Szymaniak wrote:
    Thanks for all replies.
    Below is server's tnsnames.ora
    CT =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = krzysztof)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = XE)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (CONNECT_DATA =
    (SID = CLRExtProc)
    (PRESENTATION = RO)
    SQL Error: ORA-12154: TNS:could not resolve the connect identifier specified
    12154. 00000 - "TNS:could not resolve the connect identifier specifie
    Rgds
    Krzysztof
    PS. I tried with using 'XE' - not working.Assuming that is the correct tnsnames, of course XE is not working. You don't have a tnsnames entry for 'XE'.
    You need to be aware that when using a dblink, the client is the db in which the link is defined, not the desktop from which you connect to that database.
    I think you need to start here:
    http://edstevensdba.wordpress.com/2011/02/26/ora-12154tns-03505/
    http://edstevensdba.wordpress.com/2011/02/09/sqlnet_overview/ (Help! I can’t connect to my database )
    http://edstevensdba.wordpress.com/2011/02/16/sqlnet_client_cfg/ (Help! I can’t connect to my database (part duex) )
    The fact that your client (db link) is a database doesn't change anything taught in the above.

  • No start instance Java (problem connection database DB2)

    Hi, I have problem with start instance Java, problem connectio database.
    S.O: Solaris
    Database: DB2
    show log db2:
    ADM7519W  DB2 could not allocate an agent.  The SQLCODE is "-1225".
    show log directory work:
    com.sap.engine.frame.core.configuration.ConfigurationException: Error while connecting to DB.
            at com.sap.engine.core.configuration.impl.persistence.rdbms.DBConnectionPool.createConnection(DBConnectionPool.java:365)
            at com.sap.engine.core.configuration.impl.persistence.rdbms.DBConnectionPool.<init>(DBConnectionPool.java:130)
            at com.sap.engine.core.configuration.impl.persistence.rdbms.PersistenceHandler.<init>(Persistence
    Handler.java:38)
            at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.<init>(ConfigurationCache.java:149)
            at com.sap.engine.core.configuration.bootstrap.ConfigurationManagerBootstrapImpl.init(ConfigurationManagerBootstrapImpl.java:236)
            at com.sap.engine.core.configuration.bootstrap.ConfigurationManagerBootstrapImpl.<init>(ConfigurationManagerBootstrapImpl.java:49)
            at com.sap.engine.bootstrap.Synchronizer.<init>(Synchronizer.java:74)
            at com.sap.engine.bootstrap.Bootstrap.initDatabaseConnection(Bootstrap.java:474)
            at com.sap.engine.bootstrap.Bootstrap.<init>(Bootstrap.java:147)
            at com.sap.engine.bootstrap.Bootstrap.main(Bootstrap.java:946)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:331)
            at com.sap.engine.offline.OfflineToolStart.main(OfflineToolStart.java:81)
    Caused by: com.ibm.db2.jcc.am.SqlException: DB2 SQL Error: SQLCODE=-10003, SQLSTATE=57011, SQLERRMC=null, DRIVER=3.59.81
    [Bootstrap module]> Problem occurred while performing synchronization.
    Help please.

    Hey Eli,
    It looks like a memory issue. It would be good if you could provide more lines from db2diag.log file.
    Please make sure that DB2 configuration complies with the default suggested. Below link would help you understand better.
    http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.qb.server.doc/doc/t0008238.html
    More over set the ulimit for virtual memory and maximum memory size to unlimited in order to maximize the use of your current physical memory, after that restart DB2.
    Please let us know if issue gets resolved.
    Cheers!!!
    Vishi Rajvanshi

  • Comparatively analysis of legacy database system ?

    please help me by explain this this is our next quiz can any 1 give detail description to this topic :O :)

    Hello,
    A comparative analysis of legacy database systems examines the essential nature of legacy database management, and discusses
    the validity of parallels which appear to exist between them. The characteristics of applications, functions, representations, utilizations, and research are used as a basis for conducting comparisons. Through these comparisons, the strengths and weaknesses
    of each field are evaluated, and significant similarities and differences are identified.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • ADDM and performance analysis problem

    Respected Everyone,
    I am facing a problem, the detail is as under.
    Few days back, my users complained about slow db response, when i opened the oem control page, i got to know the sysman user started a series of commands and consuming the cpu resources from the last 2 hours. i analyzed few commands running under the session and decided to kill it. After killing the session everything was ok, except one thing which i noticed after few hours that performance analysis is not refreshing the advices on the oem control general page.
    What efforts i have done so far ?
    1) i first started ADDM maually but even on ADDM result page, it showing the same old statictics.
    2) i restarted the database, but of no use.
    3) I restarted the machine thought it may be dbconsole problem but of no use.
    Now guys kindly suggest me what should i do now.
    Thanks and Best Regards
    Nadeem Hameed

    Well i checked the ADDM analysis, its ok in ADDM page,
    Tell my why its not updating the statistics on the general page.
    Thanks
    Nadeem

  • Temperature sweep analysis problem

    Hello
    I am having problem getting even the simplest  temperature sweep analysis to work in multisim 10.
    As an example, please see attached circuit and pictures.
    The circuit contains a simple voltage divider where R1 has a TC1 of 1 ohm/C, and as shown in figure 1, the resulting voltage is 0.5V when running simulation at
    27degree C with TNOM 27C.
    Raising the Temperature to 28degree C results in a resulting voltage of 0.33V (figure 2) (indicating  a doubling of the R1 value because of the 1 degree temperature raise with a TC1 of 1ohm/C)
    To my understanding, the R1 value should have changed with only 1 ohm.
    Any hints on what might be the problem with my temperature analysis ??
    Does anybody know if this is a known error with Multisim ??
    Any advice/hint is appreciated !
    Attachments:
    test2.ms10 ‏37 KB
    14.JPG ‏74 KB
    22.JPG ‏63 KB

    You are correct in you observation. The value is effectively being doubled. This is apparently a software error that will have to be further addressed by NI. I am responding only verify your findings (2 or more people reporting the same results are always better than just one person reporting it).
    I have no answer as to how to work around this. NI will have to read this and maybe they can come up with a temprary solution until a permanent one can be found.
    Kittmaster's Component Database
    http://ni.kittmaster.com
    Have a Nice Day

  • Performance analysis for oracle database on weblogic 10.3 version

    Hi All,
    We are migrating our servers from windows to Linux.In the process we have weblogic 8.1 version being upgraded to weblogic 10.3.
    How could i analysis the performance of the Oracle 10g on weblogic 10.3.
    Do we have any predefined test scripts in place to perform the necessary anaylsis.
    Thanks in anticipation.
    Pavan

    We do not provide any test scripts. As you can be sure, each WLP deployment is unique to the customer environment and business problems that are being solved. Having generic test scripts would not reflect this.
    However, you might wish to read the following documentation which discusses database performance with regard to WLP.
    http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/db/db_architecture.html#wp1069661
    Brad

  • Problem with database instance installation

    Hi@all,
    I'm dealing with the installation of the sap solution manager 3.2 SR1.
    The platform is a win 2000 server, I use Oracle as the database.
    Oracle was installed successfully and the installation of the central instance terminated without errors.
    Now I try to install the next step, the database instance.
    I always choosed the standard parameters, except for I choosed no domain installation and unchecked using SLD.
    Nevertheless, the installation procedure stops at step 16 with the following error log entry (partially translated from german to english):
    System call failed. Error 1332 (Allocations of account names and safety identifications were not accomplished.
    ) in execution of system call 'LookupAccountName' with parameter (NULL, Administrators, ...), line (305) in file (synxcaccmg.cpp).
    I've attached the full logfille here.
    Looks like sapinst cannot get the system user parameters?
    How could I solve this? Any idea?

    This was the clue
    I read through the whole planning and preparation tutorial and through the preinstallation and installation tutorial.
    There's no recommondation to have the english os version installed.
    But better such an easy problem instead of a difficult one
    Thanks a lot!

Maybe you are looking for

  • SSO with XI 3.1

    I have BO XI 3.1 SP3 installed on a Windows 2008 4 bit server. I enabled SSO with Tomcat, it is working but not all the times. I configured SSO, when users go to Infoview it dosen't prompt them for user credentials but this is not happening all the t

  • OAM Webgate Ip validation problem caused by load balancer...

    Hi all, In my topology, i have 5 webgates on 5 OHS web servers running in reverse proxy mode . Those web servers are behind load balancer. Since load balancer is working in proxy mode, all requests seems to be coming from load balancer vip and this p

  • Keyboard lights on envy m6?

    r there anykeyboard lights on envy m6 notebook 4 night use? thankyou. cheryl_k

  • Still images blur on playback

    hello all: I am using Final Cut HD and I am having problems with jpgs and PSD files blurring on playback. they look fine as still... but when I press the space bar to playback they blur horribly. I didn't used to have this problem. A recent change to

  • Memory Consumption: Start A Petition!

    I am using SQL Developer 4.0.0.13 Build MAIN 13.80.  I was praying that SQL Developer 4.0 would no longer use so much memory and, when doing so, slow to a crawl.  But that is not the case. Is there a way to start a "petition" to have the SQL Developm