MySQL adalah salah satu aplikasi database server yang sangat terkenal hari ini. Dimana MySQL Database Server dapat digunakan untuk menyimpan informasi atau pengambilan data yang sesuai dengan syarat-syarat yang telah ditentukan dengan menggunakan operator-operator tertentu dengan menggunakan perbandingan dan logika.
Untuk mengambil data yang sesuai dengan syarat tertentu, perintah query yang sering digunakan adalah klausa WHERE yang diikuti dengan perintah operator-operator perbandingan dan logika.
Untuk mengenal lebih jauh tentang Operator-operator yang ada pada MySQL database, berikut ini merupakan daftar operator-operator tersebut:
- = : Evaluates to true if both arguments are equal, unless both conditions are NULL
- <=> : Evaluates to true if both arguments are equal, even if both conditions are NULL
- <>, != : Evaluates to true if the two arguments are not equal.
- < : Evaluates to true if the value of the first argument is less than the value of the second argument.
- <= : Evaluates to true if the value of the first argument is less than or equal to the value of the second argument.
- > : Evaluates to true if the value of the first argument is greater than the value of the second argument.
- >= : Evaluates to true if the value of the first argument is geater than or equal to the value of the second argument.
- IS NULL : Evaluates to true if the argument equals a null value.
- IS NOT NULL : Evaluates to true if the argument does not equal a null value.
- BETWEEN : Evaluates to true if the value of the argument falls within the range specified by the BETWEEN clause.
- NOT BETWEEN : Evaluates to true if the value of the argument does not fall within the range specified by the NOT BETWEEN clause.
- IN : Evaluates to true if the value of the argument is specified within the IN clause.
- NOT IN : Evaluates to true if the argument is not specified within the NOT IN clause.
- LIKE : Evaluates to true if the value of the argument is not specified by the Like construction
- NOT LIKE : Evaluates to true if the value the argument is not specified by the NOT LIKE construction.
- EGEXP : Evaluates to true if the value of the argument is specified by the REGEXP construction.
- NOT REGEXP : Evaluates to true if the value of the argument is not specified by the NOT REGEXP construction.
Sedangkan untuk Logical Operator adalah sebagai berikut:
- AND : Evaluates to true if both of the two arguments or expressions evaluate to tru. You can use double ampersands (&&) in place of the AND operator.
- OR : Evaluates to true if either of the two arguments or expressions evaluates to true. You can use the double vertical pipes (||) in place of the OR operator
- XOR : Evaluates to true if exactly one of the two arguments or expressions evaluate to true.
- NOT, ! : Evaluates to true if the argument or expression evaluates to false. You can use an exclamation point (!) in place of the NOT operator.