Learn something new every day
More Info... by email
Query by example (QBE) is a query language for relational databases similar to Structured Query Language (SQL). The "by example" portion of this data gathering language allows the person or application looking to retrieve data from the relational database to complete the information that they know about the data they are looking for. The Query by example method might include a form that the user would complete to generate a SQL query that the database understands.
Suppose for example that there existed a database full of employees in an organization and this information was made available to the employees in case they needed to communicate with other employees. The database storing the information understands commands like select fname from employees where lname = 'smith', however many people do not understand this type of syntax. Query by example can help with this. The following statement:
select fname, lname, extension from employees where lname ='smith'
tells the database to look through the employees table of information and display all of the first names (fname), last names, (lname), and phone extensions (extension) where the last name field contains the value smith. Using a QBE style query, the user looking for this information could provide the information that they know, last name = 'smith', and see the information related to that last name. This allows the employee to give an example of what they are looking for and see the results returned.
The query sent to the database in the above example looks just like the SQL statement shown above, even though the person performing the lookup told the database only that the last name was Smith and then which items he or she needed to know, the first name, last name, extension. Since most query by example use involves a form or application for data entry, the table employees could be hard coded into the system so the users do not need to worry about that.
Another similar example is the recipient lookup used by Microsoft Outlook Web Access®. When someone clicks the To field header, another form opens up allowing that person to complete the items they know about and click the find button, all records matching the specified example will be returned and the employee can click the correct information to use it in an email message.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!