MySQL 視圖可以透過使用 AND、OR 和 NOT 等邏輯運算子的組合來建立。可以藉助以下範例進行說明 -
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)#
以上是在建立 MySQL 視圖時如何使用邏輯運算子組合?的詳細內容。更多資訊請關注PHP中文網其他相關文章!