#MySQL views can be created by using a combination of logical operators such as AND, OR, and NOT. This can be explained with the help of the following example -
mysql> Create or Replace View Info AS select ID, Name, Address , Subject FROM Student_info WHERE (Subject = 'Computers' AND ADDRESS = 'Delhi') OR (Subject = 'History' AND Address = 'Amritsar'); Query OK, 0 rows affected (0.11 sec) mysql> Select * from Info; +------+-------+---------+-----------+ | ID | Name | Address | Subject | +------+-------+---------+-----------+ | 133 | Mohan | Delhi | Computers | +------+-------+---------+-----------+ 1 row in set (0.00 sec)
The above is the detailed content of How to use logical operator combinations when creating MySQL views?. For more information, please follow other related articles on the PHP Chinese website!