Predicate Operations

This section provides a list of predicate operations supported by SQL and some examples.

Predicate operations are operations that can be evaluated to give a condition of true or false:

1. "Comparison" Predicates: Compares two values of the same type according to a predefined order. There are 6 comparison operations:

2. "Between" Predicates: Check a given value against a value range. There are 2 "between" operations:

3. "In" Predicates: Check a given value against a list of values. There are 2 "in" operations:

4. "Like" Predicates: Check a given character string against a character pattern. By default "Like" operations are not case sensitive. There are 2 "Like" operations:

"pattern" is a character string with wildcard characters and escape sequences:

Examples:

'abc' LIKE 'Abc' -- true
'3.14' LIKE '_.__' -- true
'3.14159' LIKE '3.%' -- true
'herong_yang' LIKE 'herong\_yang' -- true
'4.75%' LIKE '_.__\%' -- true

5. "Null" Predicates: Check a given value against null value. There are 2 "Null" operations:

Examples:

1 IS NULL -- false
'a' IS NOT NULL -- true
NULL IS NULL -- true
NULL IS NOT NULL -- false

Last update: 2015.

Table of Contents

 About This Book

 Introduction of SQL

 MySQL Introduction and Installation

 Introduction of MySQL Programs

 Perl Programs and MySQL Servers

 PHP Programs and MySQL Servers

 Java Programs and MySQL Servers

 Datatypes and Data Literals

Operations and Expressions

 What Is Expression

 Arithmetic Operations

Predicate Operations

 Date and Time Operations

 Examples of Different Types of Operation

 Character Strings and Bit Strings

 Commonly Used Functions

 Table Column Types for Different Types of Values

 Using DDL to Create Tables and Indexes

 Using DML to Insert, Update and Delete Records

 Using SELECT to Query Database

 Transaction Management and Isolation Levels

 Locks Used in MySQL

 Defining and Calling Stored Procedures

 Variables, Loops and Cursors Used in Stored Procedures

 Outdated Tutorials

 References

 PDF Printing Version