Please-Help with SQL NewBee

Hello please help me with an sql, I have a table with 2 fields, I want to check if one of the field is blank, mining that it dosn't contain anything.
if table called Test has 2 fields name ,age.
how do I check in sql if age is blank.
thanks

Are you trying to do this through mSQL in Lite?
- Junius

Similar Messages

  • Please help with SQL amount calulation

    -- Results
    with t as ( 
    select 'P11877' Mstr_Program,   1 Year_of_study, 'BUSI1490' program_module,  20 no_of_stud,    1 rank,   30 program_credits,  30 cumm_credits   from dual union all
    select 'P11877',                1,              'COMP1365',                 20,               2,        30,                  60               from dual union all
    select 'P11877',                1,              'BUSI1375',                 20,               3,        30,                  90               from dual union all
    select 'P11877',                1,              'COMP1363',                 20,               4,        30,                  120              from dual union all
    select 'P11877',                2,              'MARK1174',                 8,                1,        30,                  30               from dual union all
    select 'P11877',                2,              'FINA1068',                 8,                2,        15,                  45               from dual union all
    select 'P11877',                2,              'INDU1062',                 8,                3,        30,                  75               from dual union all
    select 'P11877',                2,              'BUSI1329',                 8,                4,        15,                  90               from dual union all
    select 'P11877',                2,              'MARK1138',                 8,                5,        30,                  120              from dual)
    select * from t;-- Each MSTR_PROGRAM can have 1 or many program_module
    -- MSTR_PROGRAM's can run for 1 or 2 years (case above is two years) so some modules run in year 1 and some in year 2
    -- NO_OF_STUD is the number of students on the module
    -- RANK basically ranks the modules by the number of students on them grouped by program and year
    -- e.g.row_number() OVER (PARTITION BY Mstr_Program, Year_of_study) ORDER BY COUNT(STUDENT_ID) DESC) rank
    -- PROGRAM_CREDITS: each module has a fixed number of credits
    -- CUMM_CREDITS: Increments the credit count of modules
    -- SUM(program_credits * 10) OVER (PARTITION BY Mstr_Program, Year_of_study
    -- ORDER BY count(STUDENT_ID) desc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) cumm_credits
    -- I want to trim of any modules once the CUM_CREDITS hits 120. As seen above. I achieve this by wrapping the main query is another SELECT then LIMIT
    -- that WHERE cum_credit <=120.
    -- But what I need is:
    -- In some cases the the cumm_credit maybe on lets say 90credits then the next module is worth 40 credits. This next module will not show as it
    -- will be greater than 120 credits, so i need to pro-rata it:
    -- So if credit_count > 120, then the last module is counted pro-rata as follows: 1- ((credit count - 120) / credits from last module
    -- Can anyone help with how I can incorporate this into my current code: The SELECT portion of the Original SQL is below: I simplified column names
    -- e.t.c in the above so they wont be the same
    SELECT * FROM (
         SELECT
               ,SR_PROGRAM Mstr_Program
               ,DECODE (SORLCUR_YEAR, 1, 1,
                                      2, 2,
                                      3, 3,
                                      4, 3, SR_YEAR) year_of_study
               ,SCT_SUBJ_CODE||SCT_CRSE_NUMB program_module
               ,COUNT(student_ID)                    no_of_stud
               ,row_number() OVER (PARTITION BY sr_program,
                                            DECODE (sr_year, 1, 1,
                                                                  2, 2,
                                                                  3, 3,
                                                                  4, 3, SR_YEAR) ORDER BY COUNT(student_id) DESC, scbcrse_title asc) rank
               ,(SCT_CREDIT_HRS * 10) program_credits
               ,SUM(SCT_CREDIT_HRS * 10) OVER (PARTITION BY sr_program, DECODE (sorlcur_year, 1, 1,
                                                                                                       2, 2,
                                                                                                       3, 3,
                                                                                                       4, 3, SR_YEAR)
                                                    ORDER BY count(student_id) desc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) cumm_credits
    WHERE cumm_credit <=120
    ORDER BY Mstr_Program, YEAR_OF_STUDY, RANK asc;

    Maybe
    SELECT Mstr_Program,year_of_study,program_module,no_of_stud,rank,program_credits old_program_credits,cumm_credits old_cumm_credits,
           case when cumm_credits > 120
                then program_credits - cumm_credits + 120
                else program_credits
           end new_program_credits,
           case when cumm_credits > 120
                then 120
                else cumm_credits
           end new_cumm_credits
      FROM (SELECT SR_PROGRAM Mstr_Program,
                   DECODE(SORLCUR_YEAR,1,1,2,2,3,3,4,3,SR_YEAR) year_of_study,
                   SCT_SUBJ_CODE||SCT_CRSE_NUMB program_module,
                   COUNT(student_ID) no_of_stud,
                   row_number() OVER (PARTITION BY sr_program,DECODE(sr_year,1,1,2,2,3,3,4,3,SR_YEAR)
                                          ORDER BY COUNT(student_id) DESC,scbcrse_title) rank,
                   10 * SCT_CREDIT_HRS program_credits,
                   10 * SUM(SCT_CREDIT_HRS) OVER (PARTITION BY sr_program,DECODE(sorlcur_year,1,1,2,2,3,3,4,3,SR_YEAR)
                                                      ORDER BY count(student_id) desc
                                                  ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) cumm_credits
    WHERE 0 <= case when cumm_credits > 120
                     then program_credits - cumm_credits + 120
                     else program_credits
                end
    ORDER BY Mstr_Program,YEAR_OF_STUDY,RANKRegards
    Etbin
    Edited by: Etbin on 16.12.2011 8:50
    with
    t as   /* simulating the result achieved */
    (select 'P11877' Mstr_Program,1 Year_of_study, 'BUSI1490' program_module,20 no_of_stud,1 rank,30 program_credits,30 cumm_credits from dual union all
    select 'P11877',             1,               'COMP1365',               20,           2,     40,                70              from dual union all
    select 'P11877',             1,               'BUSI1375',               20,           3,     30,                100             from dual union all
    select 'P11877',             1,               'COMP1363',               20,           4,     40,                140             from dual union all
    select 'P11877',             2,               'MARK1174',               8,            1,     30,                30              from dual union all
    select 'P11877',             2,               'FINA1068',               8,            2,     50,                80              from dual union all
    select 'P11877',             2,               'INDU1062',               8,            3,     30,                110             from dual union all
    select 'P11877',             2,               'BUSI1329',               8,            4,     50,                160             from dual union all
    select 'P11877',             2,               'MARK1138',               8,            5,     30,                190             from dual
    select Mstr_Program,Year_of_study,program_module,no_of_stud,rank,program_credits old_credits,cumm_credits old_cumm,
           case when cumm_credits > 120
                then program_credits - cumm_credits + 120
                else program_credits
           end new_program_credits,
           case when cumm_credits > 120
                then 120
                else cumm_credits
           end new_cumm_credits
      from t
    where 0 <= case when cumm_credits > 120
                     then program_credits - cumm_credits + 120
                     else program_credits
                end

  • Please Help with sql.Date problem

    I have spent alot of time on what I thought would be an otherwise simple task, and I beleive I am close to completion but I need some much needed help. I have posted various forms of my code to try and acheive the solution but the responses received have been limited.
    I am trying to delete a record from a MS Access database where a Date/Time field in the database (Err_Date) equals a date entered by the user via a textbox.
    I finally have gotten the correct record to delete from the database, but what is very strange is that Tomcat is throwing a 'java.lang.NullPointerException' error. Then when I re-open the database the correct record is deleted.
    Here is my code:
    <%@page import="java.sql.*"%>
    <%@ page import="java.text.SimpleDateFormat"%>
    <%@ page import="java.util.Date"%>
    <%
    Connection con = null;
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:errorlog", "admin", "");
    catch(Exception e){
         out.println(e.getMessage());
    ResultSet rs=null;
    Statement stmt=null;
    try {
    stmt=con.createStatement();
    String end = request.getParameter("To");//FROM TEXTBOX
    java.text.SimpleDateFormat df = new java.text.SimpleDateFormat ("dd/MM/yyyy");
    java.util.Date d2 = df.parse(end);//CONVERT STRING TO UTIL DATE
    java.sql.Date date2 = new java.sql.Date(d2.getTime());//CONVERT TO SQL
    PreparedStatement stmnt = con.prepareStatement("DELETE FROM tblError WHERE Err_Date = ?");
    stmnt.setDate(1, date2);
    stmnt.executeUpdate();
    stmnt.close();          
    //CLOSE RESULT SET          
    rs.close();
         stmt.close();
    con.close();
    //CATCH EXCEPTIONS
    catch (SQLException e) {
         out.println(e.getMessage());
    %>

    well, in case anyone ever runs into a problem this stupid again the solution is as follows.
    the code to:
    1. retrieve date from text box
    2. covert string into util date
    3. convert util date into sql date
    4. delete from database
    is all correct.
    the problem is that I previously used String sql="SOME SQL DELETE" and then executed the result set, which of course I then had to close. This wasn't working so I switched to a Prepared Statement. I forgot to remove the 'rs.close()' statement in my code. So Tomcat was trying to close a result set that was never opened...

  • Please help with SQL command

    Hi,
    I'm trying to update a record but I don't know how to update one field in this record. This is my code so far
    private void updateProcess() {
    int nrows;
    String sql = "UPDATE student SET s_first = '" + txtS_first.getText()
         + "', s_mi = '" + txtS_mi.getText()
         + "', s_last = '"      + txtS_last.getText()
         + "', s_dob = TO_DATE('" + txtS_dob.getText() + "', 'MM/DD/YYYY')"
    /* In a database table, after the s_dob column is f_id column, but a user will see info of this field by f_first and f_last instead of f_id. How can I update this column with f_id if a user's input is f_first and f_last? What if f_first and f_name that a user enters doesn't exist in the database, is there anyway to display an error for this case?
         + "', f_first = '" + txtF_first.getText()
         + "', f_last = '" + txtF_last.getText()
         + "' WHERE s_id = " + txtS_id.getText();
    try {
         nrows = stmt.executeUpdate(sql);
    // I think this part I'm doing wrong because the text area doesn't display these strings
         if(nrows > 0) {
         lblShowResult.setText("Update successed");
         lblShowResult.setVisible(true);
    } // end if
    else {
         lblShowResult.setText("Update failed");
    lblShowResult.setVisible(true);
    } // end else
         rset.close();
    } // end try
    catch (SQLException e) {}
    catch (NullPointerException e){}
    } // end updateProcess

    If you read the docs for executeUpdate, you'll see that it returns the number of rows affected. So if it returns zero, then no rows matched.
    Also, you should be using PreparedStatement rather than Statement. Then you won't have to worry about weird characters in strings or formatting dates (you can just give it a java.sql.Date object).

  • Need help with SQL Query with Inline View + Group by

    Hello Gurus,
    I would really appreciate your time and effort regarding this query. I have the following data set.
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
    1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
    Please Ignore '----', added it for clarity
    I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
    The query should return the following data set
    Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
    1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
    7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
    4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
    The following is my query. I am kind of lost.
    select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    from (
    select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
    from INVOICE
    group by sequence_id,check_date, check_number, invoice_number, vendor_number
    ) A, INVOICE B
    where A.sequence_id = B.sequence_id
    Thanks,
    Nick

    It looks like it is a duplicate thread - correct me if i'm wrong in this case ->
    Need help with SQL Query with Inline View + Group by
    Regards.
    Satyaki De.

  • HT5824 I switched over from an iPhone to a Samsung Galaxy S3 & I haven't been able to receive any text messages from iPhones. Please help with turning my iMessage completely off..

    I switched over from an iPhone to a Samsung Galaxy S3 & I haven't been able to receive any text messages from iPhones. I have no problem sending the text messages but I'm not receivng any from iPhones at all. It has been about a week now that I'm having this problem. I've already tried fixing it myself and I also went into the sprint store, they tried everything as well. My last option was to contact Apple directly. Please help with turning my iMessage completely off so that I can receive my texts.

    If you registered your iPhone with Apple using a support profile, try going to https://supportprofile.apple.com/MySupportProfile.do and unregistering it.  Also, try changing the password associated with the Apple ID that you were using for iMessage.

  • How can I sync my iPhone on a different computer without erasing my applications? My iPhone was earlier synced with a PC which I don't use anymore. Please help with proper steps, if any.

    How can I sync my iPhone on a different computer without erasing my applications? My iPhone was earlier synced with a PC which I don't use anymore.
    On the new computer, I am getting a message that my all purchases would be deleted if I sync it with new iTunes library.
    Please help with proper steps, if any.

    Also see... these 2 Links...
    Recovering your iTunes library from your iPod or iOS device
    https://discussions.apple.com/docs/DOC-3991
    Syncing to a New Computer...
    https://discussions.apple.com/docs/DOC-3141

  • Please help with "You can't open the application NovamediaDiskSupressor because PowerPC applications are no longer supported." I have seen other responses on this but am not a techie and would not know how to start with that solution.

    Please help with the message I am receving on startup ""You can't open the application NovamediaDiskSupressor because PowerPC applications are no longer supported."
    I have read some of the replies in the Apple Support Communities, but as I am no techie, I would have no idea how I would implement that solution.
    Please help with what I need to type, how, where, etc.
    Many thanks
    AppleSueIn HunterCreek

    I am afraid there is no solution.
    PowerPC refers to the processing chip used by Apple before they transferred to Intel chips. They are very different, and applications written only for PPC Macs cannot work on a Mac running Lion.
    You could contact the developers to see if they have an updated version in the pipeline.

  • Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be ab

    Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be able to download the srtony adobe.

    Adobe - Lightroom : For Macintosh
    Hal

  • [ETL]Could you please help with a problem accessing UML stereotype attributes ?

    Hi all,
    Could you please help with a problem accessing UML stereotype attributes and their values ?
    Here is the description :
    -I created a UML model with Papyrus tool and I applied MARTE profile to this UML model.
    -Then, I applied <<PaStep>> stereotype to an AcceptEventAction ( which is one of the element that I created in this model ), and set the extOpDemand property of the stereotype to 2.7 with Papyrus.
    -Now In the ETL file, I can find the stereotype property of extOpDemand as follows :
    s.attribute.selectOne(a|a.name="extOpDemand") , where s is a variable of type Stereotype.
    -However I can't access the value 2.7 of the extOpDemand attribute of the <<PaStep>> Stereotype. How do I do that ?
    Please help
    Thank you

    Hi Dimitris,
    Thank you , a minimal example is provided now.
    Version of the Epsilon that I am using is : ( Epsilon Core 1.2.0.201408251031 org.eclipse.epsilon.core.feature.feature.group Eclipse.org)
    Instructions for reproducing the problem :
    1-Run the uml2etl.etl transformation with the supplied launch configuration.
    2-Open lqn.model.
    There are two folders inside MinimalExample folder, the one which is called MinimalExample has 4 files, model.uml , lqn.model, uml2lqn.etl and MinimalExampleTransformation.launch.
    The other folder which is LQN has four files. (.project),LQN.emf,LQN.ecore and untitled.model which is an example model conforming to the LQN metamodel to see how the model looks like.
    Thank you
    Mana

  • Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Upgrade to 11.2.0.3 -- Interoperability Notes Oracle EBS R12 with Oracle Database 11gR2 (11.2.0.3) (Doc ID 1585578.1)
    Upgrade to 11.2.0.4 (latest 11gR2 patchset certified with R12) -- Interoperability Notes EBS 12.0 and 12.1 with Database 11gR2 (Doc ID 1058763.1)
    Thanks,
    Hussein

  • Please help with tricky query

    I need help with SQL query (if it can be accomplished with query at all).
    I'm going to create a table with structure similar to:
    Article_Name varchar2(30), Author_Name varchar2(30), Position varchar2(2). Position field is basicly position of an article author in the author list, e.g. if there is one author, his/her position is 0, if 2, then 1st author is 0, second is 1, etc.
    Article_Name Author_Name Position
    Outer Space Smith 0
    Outer Space Blake 1
    How can I automate creation of Position, based on number of authors on the fly? Let's say I have original table without Position, but I want to create a new table that will have this information.
    Regards

    If you have an existing table whose structure doesn't tell you what position the author is in, what's the algorithm you'd use to determine who was the first author, the second author, etc? If you issue a select query on a table without providing an "order by" clause, Oracle makes no guarantees about the order in which it retrieves rows.
    As an aside, why would you store position number in a varchar2 field? If it's a number, it ought to be stored as a number.
    Justin

  • Welcome. At the outset, I'm sorry for my English :) Please help with configuration Photoshop CS6 appearance. How to disable the background of the program so you can see the desktop. (same menus and tools) Chiałbym to be the same effect as CS5.

    Welcome.
    At the outset, I'm sorry for my English
    Please help with configuration Photoshop CS6 appearance.
    How to disable the background of the program so you can see the desktop. (same menus and tools)
    i wantto be the same effect as CS5.

    Please try turning off
    Window > Application Frame

  • Please help  with dbms_fga?

    hi all,
    audit event handler doesn't work. please help
    test: SQL>show user
    USER is "HR"
    test: SQL>--on user hr
    drop table aud_emp
    creattest: SQL>  2  e table aud_emp (aud_time date)
    create or replace procedure p_aud_emp as
    begin
      insert into aud_emp values (sysdate);
      commit;
      --do other thing later;
    end;
    Table dropped.
    test: SQL>  2
    Table created.
    test: SQL>  2    3    4    5    6    7
    Procedure created.
    test: SQL>
    test: SQL>show user
    USER is "SYS"
    test: SQL>--on user sys
    begin
    dbms_fga.drop_politest: SQL>  2  cy (
    object_schema => 'hr',
    object_name => 'employees',
    policy_name => 'audit_emps_salary');
    end;
    /  3    4    5    6    7
    PL/SQL procedure successfully completed.
    test: SQL>begin
    dbms_fga.add_policy (
    object_sche  2    3  ma => 'hr',
    object_name => 'employees',
    policy_name => 'audit_emps_salary',
    audit_condition=> 'department_id=10',
    audit_column => 'SALARY',
    handler_schema => 'hr',
    handler_module => 'p_aud_emp',
    enable => TRUE,
    statement_types=> 'select' );
    end;
    /  4    5    6    7    8    9   10   11   12   13
    PL/SQL procedure successfully completed.
    test: SQL>
    test: SQL>-- on user hr
    select first_name,salary
    test: SQL>  2  from employees
    where department_id=10;  3
    FIRST_NAME               SALARY
    Jennifer                   4400
    --it should call hr.p_aud_emp,but it didn't.
    test: SQL>
    test: SQL>select * from aud_emp;
    no rows selected  --it should insert one row here
    test: SQL>
    -- on user sys
    col object_schema forma a10
    col object_name form a15
    col policy_name form a20
    col sql_text form a40
    set lines 120
       select OBJECT_SCHEMA, OBJECT_NAME,  POLICY_NAME,SQL_TEXT
       from  DBA_FGA_AUDIT_TRAIL
    OBJECT_SCH OBJECT_NAME     POLICY_NAME          SQL_TEXT
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select * from employees
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select *
                                                    FROM employees
                                                    WHERE
                                                    department_id = 10
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id = 10
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
    OBJECT_SCH OBJECT_NAME     POLICY_NAME          SQL_TEXT
                                                    from employees
                                                    where department_id = 10
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id = 10
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id = 10
    OBJECT_SCH OBJECT_NAME     POLICY_NAME          SQL_TEXT
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id = 10
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id = 10
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id = 10
    OBJECT_SCH OBJECT_NAME     POLICY_NAME          SQL_TEXT
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id=10
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id=10
    OBJECT_SCH OBJECT_NAME     POLICY_NAME          SQL_TEXT
    HR         EMPLOYEES       AUDIT_EMPS_SALARY    select first_name,salary
                                                    from employees
                                                    where department_id=10
    13 rows selected.

    Any ideas will be greatly appreciated.
    Help to find out what issues in it please.

  • HT201210 cont contact apple server error please help with ipad touch 4. im just fed up with apple please help me because why is it only apple with these kind of problems?

    cont contact apple server error please help with ipad touch 4. im just fed up with apple please help me because why is it only apple with these kind of problems?

    If you mean updae server
    Update Server
    Try:
    - Powering off and then back on your router.
    - iTunes for Windows: iTunes cannot contact the iPhone, iPad, or iPod software update server
    - Change the DNS to either Google's or Open DNS servers
    Public DNS — Google Developers
    OpenDNS IP Addresses
    - For one user uninstalling/reinstalling iTunes resolved the problem
    - Try on another computer/network
    - Wait if it is an Apple problem
    Otherwise what server are you talking about

Maybe you are looking for