If we talk about normal queries we fire on the database they should be correct and in a well-defined structure which means they should follow a proper syntax if the syntax or query is wrong definitely we will get an error and due to that our application or calculation definitely going to stop. So to overcome this problem QBE was introduced. QBE stands for Query By Example and it was developed in 1970 by Moshe Zloof at IBM.
It is a graphical query language where we get a user interface and then we fill some required fields to get our proper result.
In SQL we will get an error if the query is not correct but in the case of QBE if the query is wrong either we get a wrong answer or the query will not be going to execute but we will never get any error.
In QBE we don’t write complete queries like SQL or other database languages it comes with some blank so we need to just fill that blanks and we will get our required result.
Consider the example where a table ‘SAC’ present in the database with Name, Phone_Number and Branch fields. And we want to get the name of SAC-Representative name who belongs to the MCA Branch. If we write this query in SQL we have to write it like
SELECT NAME FROM SAC WHERE BRANCH = 'MCA'"
And definitely we will get our correct result. But in the case of QBE, it may be done as like there is a field present and we just need to fill it with “MCA” and then click on SEARCH button we will get our required result.
Points about QBE:
- Supported by most of the database programs.
- It is a Graphical Query Language.
- Created in parallel to SQL development.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- SQL | SELECT Query
- SQL query to find second highest salary?
- Structured Query Language (SQL)
- Query Optimization in Relational Algebra
- SQL | Query Processing
- Join operation Vs Nested query in DBMS
- Query to find 2nd largest value in a column in Table
- Neo4j Query Cypher Language
- Virtual machine installation for Cassandra CQL query
- Database Roles in CQL (Cassandra Query Language)
- Additional Functions in CQL (Cassandra Query Language)
- Query Execution in HP Vertica
- Useful CQL query in Cassandra
- Features of Structured Query Language (SQL)
- SQL query using COUNT and HAVING clause
- SQL Query Complexity
- Relational Query Evaluation | Set 1
- Relational Query Evaluation | Set 2
- SQL query to find unique column values from table
- Basic SQL Injection and Mitigation with Example
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.