kids encyclopedia robot

Query by Example facts for kids

Kids Encyclopedia Facts

Query by Example (QBE) is a special way to ask questions to a database. Imagine you have a big collection of information, like a list of all your favorite video games. QBE helps you find specific games without needing to learn a complicated computer language.

It was created by Moshé M. Zloof at IBM Research in the 1970s. QBE was one of the first ways to search databases using pictures and visual tables. You would see a table on your screen and fill in what you are looking for. Many modern programs that help you search databases still use ideas from QBE.

At first, QBE was only used to find information. But later, it was improved to let you do other things. You could add new information, remove old information, or change existing details. You could even create new temporary lists of data.

Requête QBE dans Paradox
An example of a QBE search in a program called Paradox. It helps you find specific information in a database.

QBE makes it easier for people to work with databases. Instead of typing long, complex commands, you can just click and choose what you want. The computer then secretly turns your choices into commands that the database understands. This makes it much simpler and faster to find and manage information.

QBE was a big step forward in making computer tools easier for everyone to use. It showed how people could create their own computer tasks without being expert programmers.

Today, many database programs use QBE. This includes programs like Microsoft Access and Microsoft SQL Server Enterprise Manager. Some newer types of databases also use QBE ideas.

How QBE Works: A Simple Example

Let's imagine you have a database about suppliers and the parts they provide. You want to find specific information. QBE lets you do this by filling in an example of what you want.

Here's a simple example using a table:

Simple QBE example
S S# SNAME OWNER SCITY
P.SX J. DOE ROME

In this example, you are telling the database:

  • Find suppliers (S) where the part number (S#) starts with 'P.' and has 'X' somewhere in it.
  • The owner's name (OWNER) is 'J. DOE'.
  • The city (SCITY) is 'ROME'.

The database will then show you all the suppliers that match these conditions.

QBE as a General Search Tool

The idea of QBE is also used in many other computer programs. It's a way for you to search for things without knowing a special computer language. The program does all the hard work behind the scenes.

Think of it like filling out a form to search for contacts:

Example Form B: .....Name: Bob ..Address: .....City: ....State: TX ..Zipcode:

When you fill out this form, you're telling the computer: "Find me contacts where the Name is 'Bob' AND the State is 'TX'." Notice that you left "Address," "City," and "Zipcode" blank. This tells the computer you don't care about those details for this search.

The computer then creates a search command like this:

SELECT * FROM Contacts WHERE Name='Bob' AND State='TX';

This command means "Select all information from the Contacts list where the Name is 'Bob' and the State is 'TX'."

Here's another example: Example Form C: .....Name: ..Address: .....City: Sampleton ....State: ..Zipcode: 12345

This time, you're asking for contacts where the City is 'Sampleton' AND the Zipcode is '12345'.

The computer generates this command:

SELECT * FROM Contacts WHERE City='Sampleton' AND Zipcode='12345';

More advanced QBE tools let you do even more. You might have options like "Contains," "Not Contains," "Starts With," or "Greater-Than." These options help you make your searches even more specific.

You can also use special characters, called wildcards, in your searches. For example, if you use an asterisk (`*`) as a wildcard, searching for "Rob*" could find names like "Rob," "Robert," or "Robertson." This is very useful when you're not sure of the exact spelling or want to find variations of a word.

See also

Kids robot.svg In Spanish: Búsqueda mediante ejemplo para niños

  • CRUD
  • Microsoft Query by Example
  • GraphQL
  • QBIC
kids search engine
Query by Example Facts for Kids. Kiddle Encyclopedia.