- MySQL 8 for Big Data
- Shabbir Challawala Jaydip Lakhatariya Chintan Mehta Kandarp Patel
- 163字
- 2021-08-20 10:06:12
WHERE clause
The following code block has the general syntax for the select query with the WHERE clause:
SELECT FIELD1, FIELD2, FIELD3,...FIELDn from TABLE_NAME1 ,TABLE_NAME2 [WHERE condition1 [AND [OR]] condition2...
The WHERE clause is an optional part of the SELECT command. You can use AND or OR to specify conditions. The WHERE clause can also be used with DELETE and UPDATE query, which we will discuss soon in this chapter.
Here is the list of operators used with the where clause for conditions. Let's take an example of a table schema to understand these operations. Let's create a table called users with schema mentioned here having id, first_name, last_name, address, city, state, zip, login_attempts, contact_number, email, username, and password:
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(255),
`last_name` varchar(255),
`address` varchar(255),
`city` varchar(50),
`state` varchar(2),
`zip` varchar(10),
`login_attempts` int(10),
`contact_number` varchar(20),
`email` varchar(191),
`username` varchar(191),
`password` varchar(255),
PRIMARY KEY (`id`)
) ENGINE=InnoDB PRIMARY KEY (`id`) AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
推薦閱讀
- AngularJS Web Application Development Blueprints
- BeagleBone Media Center
- Mastering Articulate Storyline
- 數據結構與算法JavaScript描述
- Bootstrap 4:Responsive Web Design
- 零基礎學Python網絡爬蟲案例實戰全流程詳解(高級進階篇)
- The DevOps 2.5 Toolkit
- Java Web開發詳解
- Visual Foxpro 9.0數據庫程序設計教程
- Hadoop大數據分析技術
- Python Projects for Kids
- Android高級開發實戰:UI、NDK與安全
- Get Your Hands Dirty on Clean Architecture
- Go Systems Programming
- RESTful Web API Design with Node.js(Second Edition)