How to verify in mysql if the number of rented books is lass 1

Hi to everyone!
i have a book database,client db and rent db.In thje book db i have the number of each book! Clients came and rent books. I have to verify that the number of books in the table is >=1!How can I do this?
Can you please help me!
Thanks!

Completely untested, but should point you in the right general direction...
     // Connect to database.
     Connection C = DriverManager.getConnection("jdbc:mysql://host/database_name","username","password");
     // Prepare SQL statement to select details of requested book (by book_id?).
     PreparedStatement PStmt = C.prepareStatement("SELECT book_id, book_name, book_count FROM books where book_id=?");
     // Requested book id...:)
     int requestedBookId = 20;
     // Set placeholder value for book id.     
     PStmt.setInt(1, requestedBookId);
     // Execute...           
     ResultSet RS = PStmt.executeQuery();
     // Get record...
     RS.first();
     // Is the current book count greater than 0...     
     if ( RS.getInt("book_count") > 0 )
          // Do whatever with the "client" and "rent" databases
          // (did you mean "client" and "rent" tables?)
     // Close all     
     PStmt.close();
     RS.close();
     C.close();
     

Similar Messages

  • On an iphone 4s, when I tap the phone number in my contacts list instead of calling the number it goes to a "Welcome to mail screen" how do I make it call the number instead?

    On an iphone 4s, when I tap the phone number in my contacts list instead of calling the number it goes to a "Welcome to mail" screen with icloud, Microsoft exchange, Gmail, Yahoo, Aol & Windows Live Hotmail listed beneath. How do I make it call the number instead?

    Never heard of that.  I suspect it thinks that's an email address and you're seeing that screen b/c you don't have an email account setup on your iPhone.
    Assuming the number is valid, try a reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider. Takes about 5-15 secs of button holding and you won't lose any data or settings.

  • How, using Adobe Connect can increase the number of participants in the meeting? I need more than 25 people.

    Hi, I use licensed Adobe Connect. Earlier in the meeting could involve up to 100 people. Now only 25. How, using Adobe Connect can increase the number of participants in the meeting? I need more than 25 people.
    Thanks for your help.

    The purchasing option through adobe.com only allows up to 25 attendees. If you need more than that, you will need to purchase through a reseller. You can find one that is able to sell in your part of the world, here: Adobe Connect Partners. Just reach out to one of the Global Partners.

  • TS3899 how do i control or limit the number of email messages in my inbox?

    how do i control or limit the number of email messages in my inbox? i used to be able to pick the number of emails on my phone 100, 500, 1000, or 1500 etc. now all my (new inbox) emails are  coming to me at once. how can i control it? i have went through my entire phone and i cant find way to filter??? HELP

    That function was removed in iOS 7.

  • What does "on my mac' mean and how do i delete or reduce the number of items in there?

    What does "on my mac" mean and how do i delete or reduce the number?

    Hi ya
    I'm seeing this on my email screen, on the left hand side - under the "RSS Apple".  The number of items in there is now 752.  It's preventing me from sending and receiving emails in my AOL account.
    Any  help would be deeply appreciated.
    Thank you.

  • Coded UI: How to verify watermark displayed in the fields and Data grid?

    Hi,
    I've an requirement to verify watermark in the fields say username field displays "Username" water mark when no data is available in the field and water mark in data grid saying "No data available".
    Please observe the water mark displayed in screenshot below:
    So how to verify watermark?
    Thanks & Regards,
    Sunil
    Best Regards, Sunil Email: [email protected]

    Hello,
    Depending on what form technology you are using, you can try posting to one of the following forums:
    Windows Forms General
    Windows Presentation Foundation (WPF)
    ASP.Net forums
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • How to send multiple attachments when the number of attachment is known at

    I am creating an independent E-mail component for an n tire architecture. This component gets the email message and files_to_Attach as method parameters.
    Files to attach is inside an array list.
    So the number of files for attachment is known only at run time.
    How can I attach this files.
    If I use single instance of MimeBodyPart (ib side a Four or While loop), it attaches the last file several times.
    Please advise me on this

    hi
    some related links
    http://forum.java.sun.com/thread.jspa?threadID=684327&messageID=4429819
    http://www.jscape.com/articles/sending_email_attachments_using_java.html
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=45&t=003546
    http://www.dbforums.com/showthread.php?t=1059049
    http://www.experts-exchange.com/Programming/Programming_Platforms/Unix_Programming/Q_21072849.html

  • HOw Do I count and identify the number of groups in a groups output.

    I have a query that reads like this..
    SELECT s.spec_Sort,s.spec_ID, s.spec_Name, b.bus_Name,
    b.bus_ID
    FROM (tbl_businesses as b INNER JOIN tbl_SpecBusRel as sb ON
    b.bus_ID = sb.specbus_busid) INNER JOIN tbl_specialties as s ON
    sb.specbus_specid = s.spec_ID
    ORDER BY s.spec_Sort, b.bus_Name
    and then I am outputing like this...
    <cfoutput query="rsGetSpecialties" group="spec_Name">
    <cfif THIS IS WHAT I
    NEED)></td><td></cfif>
    <h2><a class="specialty" href="javascript;"
    onclick="dwfaq_ToggleOMaticDisplay(this,'#spec_ID#');return
    document.MM_returnValue">#spec_Name#</a></h2>
    <div id="#spec_ID#" style="display:none">
    <cfoutput><p><a
    href="#request.details#?bus_ID=#bus_ID#">#bus_Name#</a></p></cfoutput>
    </div>
    </cfoutput>
    This displays in this manner...
    Specialty
    dealer
    Specialty
    dealer1
    dealer2
    Etc...
    What I am trying to do is find out how many specialties there
    are, figure out where the middle is so I can insert a new table
    data cell and start a new column.
    Basically - two columns with the data divided in half by
    specialty NOT by the number of dealers.
    I hope that makes sense. Of course I am trying to do it w/ as
    little query action as possible. My only solution may be to have
    more than one query and the second only finds a list of the
    sepcialties that contain the dealers and then find the middle one
    and simply say if current specialty = middleSpecialty then start a
    new column.
    Thanks all,
    Chris

    Thanks for the replies. I don't need the number of occurances
    of each specialties - I simply need to know how many specialties
    there are and then split them in half.
    This may be the long way around -but it is what I did...
    <cfquery name="rsGetSpecialties" >
    SELECT s.spec_Sort,s.spec_ID, s.spec_Name, b.bus_Name,
    b.bus_ID, b.bus_Pcity, b.bus_PState
    FROM (tbl_businesses as b INNER JOIN tbl_SpecBusRel as sb ON
    b.bus_ID = sb.specbus_busid) INNER JOIN tbl_specialties as s ON
    sb.specbus_specid = s.spec_ID
    ORDER BY s.spec_Sort, b.bus_Name
    </cfquery>
    <cfset specs = valuelist(rsGetSpecialties.spec_ID)>
    <cfquery name="rsListSpecialties">
    SELECT spec_ID,spec_Name
    FROM tbl_specialties
    WHERE spec_ID in(#specs#)
    ORDER BY spec_Name
    </cfquery>
    <cfset middle = int(rsListSpecialties.recordcount/2)>
    <cfset specs = valuelist(rsListSpecialties.spec_Name)>
    <cfset middle = listgetat(#specs#,middle)>
    then displayed like this...
    <td valign="top" width="50%">
    <cfoutput query="rsGetSpecialties" group="spec_Name">
    <h2><a class="specialty" href="javascript;"
    onclick="dwfaq_ToggleOMaticDisplay(this,'#spec_ID#');return
    document.MM_returnValue">#spec_Name#</a></h2>
    <div id="#spec_ID#" style="display:none">
    <cfoutput><a
    href="#request.details#?bus_ID=#bus_ID#">#bus_Name#
    (#bus_PCity#, #bus_PState#)</a><br /></cfoutput>
    </div>
    *****This is the line that does the splitting *****
    <cfif spec_Name EQ middle></td><td
    valign="top" width="50%"></cfif>
    </cfoutput>
    </td>
    As for removing the extraneous cfoutput --> I thought that
    I needed that in order to show the material within the grouped
    data. HOw does CF know what data to repeat and what data to not
    repeat in a grouped output? I will have to look this one up some
    more.
    thanks for the help

  • How to verify which language of the Firefox (not the content language) is in a Mac?

    I want to write a script to check the Firefox. How can I verify what language of the Firefox that I installed in a Mac? (I am not talking about the view content language like this: Firefox > Preferences > Content > Languages). Thanks!

    That data is in one of the omni.ja archives and should also be the value of the general.useragent.locale pref.
    *resource://gre/update.locale (/omni.ja!/update.locale)
    *resource:///defaults/preferences/firefox.js (/browser/omni.ja!/defaults/preferences/firefox.js)
    *resource:///defaults/preferences/firefox-l10n.js (/browser/omni.ja!/defaults/preferences/firefox-l10n.js)

  • How do I get rid of the number next to the "phone" icon for missed calls on iPhone 4?

    I realize that this number is telling me the number of missed calls and/or voicemails.   However, the number remains on the main screen after I have looked at the missed call (opened "phone" and then "missed").  I can only figure out how to get it to go away when I call the number of the missed call from the missed call menu, which I don't always want to do.  How can I make the number go away without calling the number for the call that I missed? It's probably a silly question but thanks for helping!

    I have same issue I dont want to call it and why should I have to go to Voicemail when there is no voicemail?? My screen did go dark and when I relit it it went away...very weird???

  • How  to retrieve one row from the number of records in a table

    i want to retrieve the rows from the number of records in a table without using the perticular column name.

    select count(*) from table
    /If you have your table currently analyzed, and no changes have been made, then you could
    select num_rows from user_tables where table_name = 'table'

  • How to set a limit on the number of processes a session can start?

    I have an Oracle db version 10.2.0.4 running on Solaris 10. My parallel_max_servers parameter is set to 650 and the processes parameter is set to 700. But I don see one session that is spawning 129 processes and another one that is spwaning 65 processes. Is there a way to limit the number of processes that a session can spawn?

    check processes
    $ ps -ef | grep $ORACLE_SID|wc -l
    SQL> select * from v$resource_limit where resource_name ='processes';
    My parallel_max_servers parameter is set to 650 and the processes parameter is set to 700.
    PARALLEL_MAX_SERVERS
    specifies the maximum number of parallel execution processes and parallel recovery processes for an instance. As demand increases, Oracle increases the number of processes from the number created at instance startup up to this value.
    Do you use query with parallel?
    example:
    -> create table xxx PARALLEL (degree 5)
    -> select /*+ PARALLEL
    if you don't use parallel on execution processes... so, your processes not increase ;)
    By the way your db have limited proceses= 700 (Dedicated Server Processes)

  • How to configure selector according to the number of channels

    i want to select number of selector in 1d array of selectorm according to the number of channels

    If I understood what you said correctly, the vi attached should contain the answer.
    Kudos and Accepted as Solution are welcome!
    Attachments:
    arrayindicator.vi ‏8 KB

  • Forms: how to use COUNT_RECORD to get the number of record retrieved?

    After GO_BLOCK(BlockName)EXECUTE_QUERY, there must a way to obtain the number of records retrieved.
    I like to use this number to display to number of records on the form.
    Clearly, a not so good way is:
    SELECT COUNT(*) INTO :NUM_RECORD FROM Table_Name;
    It queries table one more time.
    Could any one give a clue?
    Thank you.

    Dear Kiran,
    Fom tables EINE (inforec no, plant) and EINA (inforec no, material, vendor), you can get the desired information.
    Regards,
    Prasanth

  • I'm getting too many spam or unwanted emails. How do I cut down on the number of these I receive?

    i am relatively computer illiterate, but need to reduce the number of spam or unwanted emails I receive...is this something I can do? Are there settings I can adjust?

    have a look here http://kb.mozillazine.org/Junk_Mail_Controls

Maybe you are looking for

  • Error opening Mac CS AI file on PC

    Hi, Would appreciate any help with following issue. Have a couple Macs (OS 10.5  10.4) with Illustrator CS which have created thousand of AI files over the last few yesrs.   Thes file were copied to a Windows 2003 server and shared with some PCs that

  • W530, W7-64: external monitor is dark except for mouse pointer

    Hello, I'm starting to experience this problem. Initially I had no problems with using an external monitor, but now I cannot use it. When I switch to the external monitor, the screen is dark, except for the mouse pointer which moves correctly.. Anyon

  • Oracle 11i Rapidwiz Error on RHEL5

    Hi DBAs, I am trying to install the Oracle 11.5.10.2 on Linux RHEL5.3 on a 32 bit Plateform. I am getting the error as I run the rapidwiz as 'Oracle User'. $./rapidwiz Rapid Install Wizad is validating your file system ...... Rapid Insatll Wizad will

  • Database status is currently unavailable

    hi! the web-based 10g OEM of our database displays "database status is currently unavailable" upon login as sysdba. but the database instance has already been started/opened. could it be because of the "UNKNOWN" status in my listener? if yes, what ar

  • Unable to find fm in nokia lumia after lumbar upda...

    hi i updated my phone today i am unable find the FM option after update to  Lumia 520 Country variant 3046.0000.1329.2001 kidly help me i tried to reset my phone still doest help me