# Fuzzy Logic - Database and Queries

We have studied in our previous chapters that Fuzzy Logic is an approach to computing based on "degrees of truth" rather than the usual "true or false" logic. It deals with reasoning that is approximate rather than precise to solve problems in a way that more resembles human logic, hence database querying process by the two valued realization of Boolean algebra is not adequate.

## Fuzzy Scenario of Relations on Databases

The Fuzzy Scenario of Relations on Databases can be understood with the help of the following example −

### Example

Suppose we have a database having the records of persons who visited India. In simple database, we will have the entries made in the following way −

Name Age Citizen Visited Country Days Spent Year of Visit
John Smith 35 U.S. India 41 1999
John Smith 35 U.S. Italy 72 1999
John Smith 35 U.S. Japan 31 1999

Now, if anyone queries about the person who visited India and Japan in the year 99 and is the citizen of US, then the output will show two entries having the name of John Smith. This is simple query generating simple output.

But what if we want to know whether the person in the above query is young or not. According to the above result, the age of the person is 35 years. But can we assume the person to be young or not? Similarly, same thing can be applied on the other fields like days spent, year of visit, etc.

The solution of the above issues can be found with the help of Fuzzy Value sets as follows −

• FV(Age){ very young, young, somewhat old, old }

• FV(Days Spent){ barely few days, few days, quite a few days, many days }

• FV(Year of Visit){distant past, recent past, recent }

• Now if any query will have the fuzzy value then the result will also be fuzzy in nature.

## Fuzzy Query System

A fuzzy query system is an interface to users to get information from the database using (quasi) natural language sentences. Many fuzzy query implementations have been proposed, resulting in slightly different languages. Although there are some variations according to the particularities of different implementations, the answer to a fuzzy query sentence is generally a list of records, ranked by the degree of matching.