# FSQL

### From Seo Wiki - Search Engine Optimization and Programming Languages

**FSQL**, **Fuzzy Structured Query Language**, or **Fuzzy SQL**, means, fuzzy SQL language. It is an extension of the SQL language that allows users to write flexible conditions in their queries. using the fuzzy logic defined by Lofti A. Zadeh.

Some of the main extensions to SQL are:

**Linguistic Labels**: If an attribute is capable of fuzzy treatment then linguistic labels can be defined on it. These labels will be preceded with the symbol $ to distinguish them easily. There are two types of labels and they will be used in different fuzzy attribute types:- Labels for attributes with an ordered underlined fuzzy domain: Every label of this type has associated a trapezoidal possibility distribution.
- Labels for attributes with an non ordered fuzzy domain. Here, there is a similarity relation defined between each two labels in the domain. The similarity degree is in the interval [0,1].

**Possibility and Necessity Fuzzy Comparators**: Besides the typical comparators (=, >...), FSQL includes the fuzzy comparators in the following table. Like in SQL, fuzzy comparators may compare one column with one constant or two columns of the same type.Comparator for Possibility Comparator for Necessity Significance FEQ or F= NFEQ or NF= Fuzzy EQual (Possibly/Necessarily Equal) FDIF, F!= or F<> NFDIF, NF!= or NF<> Fuzzy DIFferent FGT or F> NFGT of NF> Fuzzy Greater Than FGEQ or F>= NFGEQ or NF>= Fuzzy Greater or Equal FLT or F< NFLT or NF< Fuzzy Less Than FLEQ or F<= NFLEQ or NF<= Fuzzy Less or Equal MGT or F>> NMGT or NF>> Much Greater Than MLT or F<< NMLT or NF<< Much Less Than </CENTER>

Possibility comparators are more general than necessity comparators are. Then, necessity comparators retrieve less tuples and these comply with the conditions necessarily.

**Inclusion Fuzzy Comparators**: FSQL includes two comparators for the inclusion operation: FINCL (Fuzzy Included in) and INCL (Included in).**Fulfilment thresholds**(T): For each simple condition a fulfilment threshold may be established (default is 1). with the format:condition THOLD T indicating that the condition must be satisfied with minimum degree T in [0,1] to be considered. The reserved word THOLD is optional and may be substitute for a traditional crisp comparator (=, <...), modifying the query meaning. The word THOLD is equivalent to using the crisp comparator greater or equal. The constant T maybe substituted by a qualifier (a predefined label) like $High or $Low.

Example: Give me all persons with fair hair (in minimum degree 0.5) that they are possibly taller than label $Tall (in minimum degree 0.8):

SELECT * FROM Person WHERE Hair FEQ $Fair THOLD 0.5 AND Height FGT $Tall THOLD 0.8 </center>

**Function CDEG(attribute)**: It shows a column with the fulfilment degree of the condition of the query, for a specific attribute, which is expressed between brackets as the argument. If logic operators appear, the calculation of this compatibility degree is carried out in the following way: We use the minimum T-norm and the maximum T-conorm, but the user may change these values by default modifying only a view (FSQL_NOTANDOR). In this view the user can set the function to use for every logic operator (NOT, AND, OR). Obviously, that function must be implemented in the FSQL Server or may be implemented by the user himself.**Basic Fuzzy Constants**: Firstly, FSQL defined the syntax for some fuzzy constants. These fuzzy constants that we can use in FSQL are detailed in the following table:Fuzzy Constant Significance UNKNOWN Unknown value but the attribute is applicable UNDEFINED The attribute is not applicable or it is meaningless NULL Total ignorance: We know nothing about it $[a,b,c,d] Fuzzy trapezium (a<=b<=c<=d) $label Linguistic Label: It may be a trapezium or a scalar (defined in FMB).

[n,m] Interval "Between n and m" (a=b=n and c=d=m). #n Fuzzy value "Approximately n" (b=c=n and n-a=d-n=margin). </CENTER>

**Extended Fuzzy Constants**: In FSQL we can also use the following fuzzy constants:Fuzzy Constant Significance $[a,b,c,d,P1/N1,…,Pn/Nn] Extended fuzzy trapezoid (with some points Pi/Ni where all the Ni are between a and b or between c and d). Values b and c are both optional. If they do not exist, then this constant is a fuzzy value without kernel.

n+-m Fuzzy value “Approximately n”: triangle n ± m. {P1/L1, P2/L2,…, Pn/Ln} Non-continuous possibility distribution on labels, where P1, P2, …, Pn are the possibility values and L1, L2, …,Ln are the labels. {L1, L2,…, Ln} Non-continuous possibility distribution on labels, where L1, L2, …, Ln are the labels, with possibility degrees 1 for all of them: {1/L1, …, 1/Ln}. {P1/N1, P2/N2,…, Pn/Nn} Non-continuous possibility distribution on numbers, where P1, P2, …, Pn are the possibility values and N1, N2, …, Nn are the numbers. {N1, N2,…, Nn} Non-continuous possibility distribution on numbers, where N1, N2, …, Nn are the numbers, with possibility 1 for all of them: {1/N1, …, 1/Nn}.

</CENTER>

**More characteristics:**fuzzy quantifiers in queries, dynamic change of functions in logic operations, fuzzy set operators (FUNION, FINTERSECT and FMINUS), the ALTER FSQL statement, some useful functions to handle fuzzy attributes and fuzzy values (cardinality, normalization, concentration or dilatation, contrast intensification or fuzzification...), some DDL statements of FSQL and fuzzy comparators for fuzzy time in FSQL (F_BEFORE, NF_BEFORE, F_AFTER, NF_AFTER, F_MUCH_BEFORE, NF_MUCH_BEFORE, F_OVERLAPS...). </UL>## External links

- Web page about FSQL: References, software and links.
- Galindo J., Urrutia A., Piattini M., "Fuzzy Databases: Modeling, Design and Implementation". Idea Group Publishing Hershey, USA, 2006.
- Galindo, J. (Ed.), (2008). Handbook of Research on Fuzzy Information Processing in Databases. Hershey, PA, USA: Information Science Reference (http://www.info-sci-ref.com).es:FSQL