Results 1 to 4 of 4

Thread: queries

  1. #1
    Join Date
    Feb 2002
    Location
    India
    Posts
    11

    Unhappy Unanswered: queries

    hii
    i am developing a library managment system using vb and oracle...
    i want to provide queries so that user can see the books available,
    no of copies of each books,and complex queries....

    what is the best possible way in which i can provide queries without disclosing the underlying tables...aslo i am assume the user to know nothing abt oracle(queries) the interface should be simple and understandable and should provide the power of queries...

    plzz help me with this one...

    sairam

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002

    queries without sql

    what a great question

    what is the reason for not showing underlying tables? in my experience, it is either an edict by the powers-that-be, or not wanting the users to need to know sql

    generally speaking, you should give an sql interface only to geeks (and i mean that in a nice way)

    non-geeks want something that lets them construct all kinds of different queries, but without having to know sql

    table layouts, in this situation, can be very helpful

    anyhow, the best models for this behaviour are web search engines

    for example, google's advanced search has text input fields for word and phrase searching, and drop-down choices for Language, File Format, Date, Occurrences, and Domain, and a radio button for SafeSearch

    if you were to build a screen like that, which fields would be of interest to your library users? title, author, copies? would these be text input fields, dropdowns, or radio buttons?

    these form elements all map to fields in your database tables, and so you would take the user's choices and generate the sql dynamically

    rudy
    http://rudy.ca/

  3. #3
    Join Date
    Feb 2002
    Location
    India
    Posts
    11
    hii

    well i am still not very clear abt wht to do..the person i am providing this software has no knowledge abt sql....
    the problem i am most concerned is how do i let the user specify the where clause which can sometimes inlcuderelating many tables...
    can u plzz proivde me with a sample interface....

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    okay, let's say you decide to provide two fields -- a search string text field and a dropdown list

    Search For: [____________]
    Search In: [Select One[v]]

    so the user enters some string into the "Search For" text field, and makes a choice from the following "Search In" dropdown list options --

    - Title
    - Author
    - Description

    then your interface generates the sql as follows:

    select * from books
    where
    <IF SearchIn = "Title">
    title
    <ELSEIF SearchIn = "Author">
    author
    <ELSE>
    description
    <ENDIF>
    like '%' || SearchFor || '%'

    so you dynamically choose which table field to test in the WHERE clause, based on the choice made for the dropdown, and also you put the wildcard characters around whatever they enter in the SearchFor text field

    that's basically how you would do it

    and of course if you have multiple fields, like the google advanced search page i showed you, your interface gets a bit more complicated

    rudy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •