html-flip-book-react 0.0.0-alpha.1 → 0.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/FlipBook.d.ts +26 -0
  2. package/dist/FlipBook.d.ts.map +1 -0
  3. package/dist/assets/html-flip-book.css +1 -0
  4. package/dist/flip-book.js +47 -1405
  5. package/dist/flip-book.js.map +1 -1
  6. package/dist/toolbar/FirstPageButton.d.ts +9 -0
  7. package/dist/toolbar/FirstPageButton.d.ts.map +1 -0
  8. package/dist/toolbar/FullscreenButton.d.ts +11 -0
  9. package/dist/toolbar/FullscreenButton.d.ts.map +1 -0
  10. package/dist/toolbar/LastPageButton.d.ts +9 -0
  11. package/dist/toolbar/LastPageButton.d.ts.map +1 -0
  12. package/dist/toolbar/NextButton.d.ts +9 -0
  13. package/dist/toolbar/NextButton.d.ts.map +1 -0
  14. package/dist/toolbar/PageIndicator.d.ts +9 -0
  15. package/dist/toolbar/PageIndicator.d.ts.map +1 -0
  16. package/dist/toolbar/PrevButton.d.ts +9 -0
  17. package/dist/toolbar/PrevButton.d.ts.map +1 -0
  18. package/dist/toolbar/Toolbar.d.ts +13 -0
  19. package/dist/toolbar/Toolbar.d.ts.map +1 -0
  20. package/dist/toolbar/ToolbarButton.d.ts +13 -0
  21. package/dist/toolbar/ToolbarButton.d.ts.map +1 -0
  22. package/dist/toolbar/ToolbarContext.d.ts +15 -0
  23. package/dist/toolbar/ToolbarContext.d.ts.map +1 -0
  24. package/dist/toolbar/index.d.ts +19 -0
  25. package/dist/toolbar/index.d.ts.map +1 -0
  26. package/dist/toolbar/index.js +174 -0
  27. package/dist/toolbar/index.js.map +1 -0
  28. package/package.json +45 -43
  29. package/dist/flip-book.d.ts +0 -14
  30. package/dist/flip-book.d.ts.map +0 -1
  31. package/example/.vscode/settings.json +0 -3
  32. package/example/README.md +0 -47
  33. package/example/assets/pages_data/en/assets/cover.jpg +0 -0
  34. package/example/assets/pages_data/en/assets/sql-command.png +0 -0
  35. package/example/assets/pages_data/en/content/000-introduction.md +0 -85
  36. package/example/assets/pages_data/en/content/001-databases.md +0 -39
  37. package/example/assets/pages_data/en/content/002-install-mysql.md +0 -162
  38. package/example/assets/pages_data/en/content/003-creating-tables.md +0 -304
  39. package/example/assets/pages_data/en/content/004-basic-syntax.md +0 -145
  40. package/example/assets/pages_data/en/content/005-select.md +0 -359
  41. package/example/assets/pages_data/en/content/006-where.md +0 -225
  42. package/example/assets/pages_data/en/content/007-order-and-group-by.md +0 -142
  43. package/example/assets/pages_data/en/content/008-insert.md +0 -86
  44. package/example/assets/pages_data/en/content/009-update.md +0 -92
  45. package/example/assets/pages_data/en/content/010-delete.md +0 -28
  46. package/example/assets/pages_data/en/content/011-join.md +0 -297
  47. package/example/assets/pages_data/en/content/012-sql-command-categories.md +0 -121
  48. package/example/assets/pages_data/en/content/013-sub-queries.md +0 -112
  49. package/example/assets/pages_data/en/content/014-unions.md +0 -124
  50. package/example/assets/pages_data/en/content/015-Keys-in-a-Relational Database.md +0 -51
  51. package/example/assets/pages_data/en/content/016-Logical-operator-keywords.md +0 -17
  52. package/example/assets/pages_data/en/content/017-having-clause_aggregate-functions.md +0 -184
  53. package/example/assets/pages_data/en/content/018-essential-mysql-functions.md +0 -190
  54. package/example/assets/pages_data/en/content/019-triggers-in-sql.md +0 -133
  55. package/example/assets/pages_data/en/content/020-TCL-commands.md +0 -154
  56. package/example/assets/pages_data/en/content/021-DCL-commands.md +0 -126
  57. package/example/assets/pages_data/en/content/100-mysqldump.md +0 -109
  58. package/example/assets/pages_data/en/content/101-learn-materialize.md +0 -267
  59. package/example/assets/pages_data/en/content/999-conclusion.md +0 -24
  60. package/example/assets/pages_data/he/4.txt +0 -2
  61. package/example/assets/pages_data/he/5.txt +0 -4
  62. package/example/assets/pages_data/he/6.txt +0 -4
  63. package/example/index.html +0 -21
  64. package/example/package-lock.json +0 -5324
  65. package/example/package.json +0 -39
  66. package/example/src/App.css +0 -52
  67. package/example/src/App.tsx +0 -25
  68. package/example/src/EnBook.tsx +0 -55
  69. package/example/src/HeBook.tsx +0 -44
  70. package/example/src/index.tsx +0 -12
  71. package/example/vite-env.d.ts +0 -1
  72. package/example/vite.config.js +0 -84
  73. package/src/FlipBook.tsx +0 -45
  74. package/vite.config.js +0 -66
@@ -1,359 +0,0 @@
1
- # SELECT
2
-
3
- As we briefly covered in the previous chapter, the `SELECT` statement allows us to retrieve data from single or multiple tables on the database. In this chapter, we will be performing the query on a single table.
4
-
5
- It corresponds to the projection operation of Relational Algebra.
6
-
7
- You can use `SELECT` to get all of your users or a list of users that match a certain criteria.
8
-
9
- Before we dive into the `SELECT` statement let's quickly create a database:
10
-
11
- ```sql
12
- CREATE DATABASE sql_demo;
13
- ```
14
-
15
- Switch to that database:
16
-
17
- ```sql
18
- USE sql_demo;
19
- ```
20
-
21
- Create a new users table:
22
-
23
- ```sql
24
- CREATE TABLE users
25
- (
26
- id INT PRIMARY KEY AUTO_INCREMENT,
27
- username VARCHAR(255) NOT NULL,
28
- about TEXT,
29
- email VARCHAR(255),
30
- birthday DATE,
31
- active BOOL
32
- );
33
- ```
34
-
35
- Insert some data that we could work with:
36
-
37
- ```sql
38
- INSERT INTO users
39
- ( username, email, active )
40
- VALUES
41
- ('bobby', 'b@devdojo.com', true),
42
- ('devdojo', 'd@devdojo.com', false),
43
- ('tony', 't@devdojo.com', true);
44
- ```
45
-
46
- Output:
47
-
48
- ```
49
- Query OK, 3 rows affected (0.00 sec)
50
- Records: 3 Duplicates: 0 Warnings: 0
51
- ```
52
-
53
- We are going to learn more about the `INSERT` statement in the following chapters.
54
-
55
- ## SELECT all columns
56
-
57
- Now that we've got some data in the `users` table, let's go ahead and retrieve all of the entries from that table:
58
-
59
- ```sql
60
- SELECT * FROM users;
61
- ```
62
-
63
- Rundown of the statement:
64
-
65
- * `SELECT`: First, we specify the action that we want to execute, in our case, we want to select or get some data from the database.
66
- * `*`: The star here indicates that we want to get all of the columns associated with the table that we are selecting from.
67
- * `FROM`: The from statement tells MySQL which table we want to select the data from. You need to keep in mind that you can select from multiple tables, but this is a bit more advanced, and we are going to cover this in the next few chapters.
68
- * `users`: This is the table name that we want to select the data from.
69
-
70
- This will return all of the entries in the `users` table along with all of the columns:
71
-
72
- ```
73
- +----+----------+-------+----------+--------+---------------+
74
- | id | username | about | birthday | active | email |
75
- +----+----------+-------+----------+--------+---------------+
76
- | 1 | bobby | NULL | NULL | 1 | b@devdojo.com |
77
- | 2 | devdojo | NULL | NULL | 0 | d@devdojo.com |
78
- | 3 | tony | NULL | NULL | 1 | t@devdojo.com |
79
- +----+----------+-------+----------+--------+---------------+
80
- 3 rows in set (0.00 sec)
81
- ```
82
-
83
- As you can see, we get a list of the 3 users that we've just created, including all of the columns in that table. In some cases, the table might have a lot of columns, and you might not want to see all of them. For example, we have the `about` and `birthday` columns that are all `NULL` at the moment. So let's see how we could limit that and get only a list of specific columns.
84
-
85
- ## Pattern matching
86
- SQL pattern matching let's you to search for patterns if you don't know the exact word or phrase you are looking for. To do this, we use so-called wildcard characters to match a pattern together with LIKE and ILIKE operators.
87
-
88
- Two of the most common wildcard characters are `_` and `%`.
89
-
90
- `_` matches any single character and `%` matches an arbitrary number of characters.
91
-
92
- Let's see an example how you would look for a `username` ending with `y`:
93
-
94
- ```sql
95
- SELECT * FROM users WHERE username LIKE '%y';
96
- ```
97
-
98
- Output:
99
- ```
100
- +----+----------+-------+----------+--------+---------------+
101
- | id | username | about | birthday | active | email |
102
- +----+----------+-------+----------+--------+---------------+
103
- | 1 | bobby | NULL | NULL | 1 | b@devdojo.com |
104
- | 3 | tony | NULL | NULL | 1 | t@devdojo.com |
105
- +----+----------+-------+----------+--------+---------------+
106
- ```
107
- As you can see above, we used `%` to match any number of characters preceding the character `y`.
108
-
109
- If we know the exact number of characters we want to match, we can use `_`. Each `_` represents a single character.
110
-
111
- So, if we want to look up an username that has `e` as its second character, we would do something like this:
112
-
113
- ```sql
114
- SELECT * FROM users WHERE username LIKE '_e%';
115
- ```
116
-
117
- Output:
118
- ```
119
- +----+----------+-------+----------+--------+---------------+
120
- | id | username | about | birthday | active | email |
121
- +----+----------+-------+----------+--------+---------------+
122
- | 2 | devdojo | NULL | NULL | 0 | d@devdojo.com |
123
- +----+----------+-------+----------+--------+---------------+
124
- ```
125
-
126
- Please, keep in mind that `LIKE` operator is case sensitive, meaning it won't mach capital letters with lowercase letters and vice versa. If you wish to ignore capitalization, use `ILIKE` operator instead.
127
-
128
-
129
- ## Formatting
130
-
131
- As we mentioned in the previous chapters, each SQL statement needs to end with a semi-colon: `;`. Alternatively, rather than using a semi-colon, you could use the `\G` characters which would format the output in a list rather than a table.
132
-
133
- The syntax is absolutely the same but you just change the `;` with `\G`:
134
-
135
- ```sql
136
- SELECT * FROM users \G
137
- ```
138
-
139
- The output will be formatted like this:
140
-
141
- ```
142
- *************************** 1. row ***************************
143
- id: 1
144
- username: bobby
145
- about: NULL
146
- birthday: NULL
147
- active: 1
148
- email: b@devdojo.com
149
- *************************** 2. row ***************************
150
- id: 2
151
- username: devdojo
152
- about: NULL
153
- birthday: NULL
154
- active: 0
155
- email: d@devdojo.com
156
- ...
157
- ```
158
-
159
- This is very handy whenever your table consists of a large number of columns and they can't fit on the screen, which makes it very hard to read the result set.
160
-
161
- ## SELECT specific columns only
162
-
163
- You could limit this to a specific set of columns. Let's say that you only needed the `username` and the `active` columns. In this case, you would change the `*` symbol with the columns that you want to select divided by a comma:
164
-
165
- ```sql
166
- SELECT username,active FROM users;
167
- ```
168
-
169
- Output:
170
-
171
- ```
172
- +----------+--------+
173
- | username | active |
174
- +----------+--------+
175
- | bobby | 1 |
176
- | devdojo | 0 |
177
- | tony | 1 |
178
- +----------+--------+
179
- ```
180
-
181
- As you can see, we are getting back only the 2 columns that we've specified in the `SELECT` statement.
182
-
183
- > **NOTE:** _SQL names are case insensitive. For example, username ≡ USERNAME ≡ userName._
184
-
185
- ## SELECT with no FROM Clause
186
-
187
- In a SQL statement, a column can be a literal with no `FROM` clause.
188
-
189
- ```sql
190
- SELECT 'Sunil' as username;
191
- ```
192
-
193
- Output:
194
-
195
- ```
196
- +----------+
197
- | username |
198
- +----------+
199
- | Sunil |
200
- +----------+
201
- ```
202
-
203
- ## SELECT with Arithmetic Operations
204
-
205
- The select clause can contain arithmetic expressions involving the operation +, –, *, and /.
206
-
207
- ```sql
208
- SELECT username, active*5 as new_active FROM users;
209
- ```
210
-
211
- Output:
212
-
213
- ```
214
- +----------+------------+
215
- | username | new_active |
216
- +----------+------------+
217
- | bobby | 5 |
218
- | devdojo | 0 |
219
- | tony | 5 |
220
- +----------+------------+
221
- ```
222
-
223
- ## LIMIT
224
-
225
- The `LIMIT` clause is very handy in case that you want to limit the number of results that you get back. For example, at the moment, we have 3 users in our database, but let's say that you only wanted to get 1 entry back when you run the `SELECT` statement.
226
-
227
- This can be achieved by adding the `LIMIT` clause at the end of your statement, followed by the number of entries that you want to get. For example, let's say that we wanted to get only 1 entry back. We would run the following query:
228
-
229
- ```sql
230
- SELECT * FROM users LIMIT 1;
231
- ```
232
-
233
- Output:
234
-
235
- ```
236
- +----+----------+-------+----------+--------+---------------+
237
- | id | username | about | birthday | active | email |
238
- +----+----------+-------+----------+--------+---------------+
239
- | 2 | bobby | NULL | NULL | 1 | b@devdojo.com |
240
- +----+----------+-------+----------+--------+---------------+
241
- ```
242
-
243
- If you wanted to get 2 entries, you would change `LIMIT 2` and so on.
244
-
245
- ## COUNT
246
-
247
- In case that you wanted to get only the number of entries in a specific column, you could use the `COUNT` function. This is a function that I personally use very often.
248
-
249
- The syntax is the following:
250
-
251
- ```sql
252
- SELECT COUNT(*) FROM users;
253
- ```
254
-
255
- Output:
256
-
257
- ```
258
- +----------+
259
- | COUNT(*) |
260
- +----------+
261
- | 3 |
262
- +----------+
263
- ```
264
-
265
- ## MIN, MAX, AVG, and SUM
266
-
267
- Another useful set of functions similar to `COUNT` that would make your life easier are:
268
-
269
- * `MIN`: This would give you the smallest value of a specific column. For example, if you had an online shop and you wanted to get the lowest price, you would use the `MIN` function. In our case, if we wanted to get the lowest user ID, we would run the following:
270
-
271
- ```sql
272
- SELECT MIN(id) FROM users;
273
- ```
274
-
275
- This would return `1` as the lowest user ID that we have is 1.
276
-
277
- * `MAX`: Just like `MIN`, but it would return the highest value:
278
-
279
- ```sql
280
- SELECT MAX(id) FROM users;
281
- ```
282
-
283
- In our case, this would be `3` as we have only 3 users, and the highest value of the `id` column is 3.
284
-
285
- * `AVG`: As the name suggests, it would sum up all of the values of a specific column and return the average value. As we have 3 users with ids 1, 2, and 3, the average would be 6 divided by 3 users which is 2.
286
-
287
- ```sql
288
- SELECT AVG(id) FROM users;
289
- ```
290
-
291
- * `SUM`: This function takes all of the values from the specified column and sums them up:
292
-
293
- ```sql
294
- SELECT SUM(id) FROM users;
295
- ```
296
-
297
- ## DISTINCT
298
-
299
- In some cases, you might have duplicate entries in a table, and in order to get only the unique values, you could use `DISTINCT`.
300
-
301
- To better demonstrate this, let's run the insert statement one more time so that we could duplicate the existing users and have 6 users in the users table:
302
-
303
- ```sql
304
- INSERT INTO users
305
- ( username, email, active )
306
- VALUES
307
- ('bobby', 'b@devdojo.com', true),
308
- ('devdojo', 'd@devdojo.com', false),
309
- ('tony', 't@devdojo.com', true);
310
- ```
311
-
312
- Now, if you run `SELECT COUNT(*) FROM users;` you would get `6` back.
313
-
314
- Let's also select all users and show only the `username` column:
315
-
316
- ```sql
317
- SELECT username FROM users;
318
- ```
319
-
320
- Output:
321
-
322
- ```
323
- +----------+
324
- | username |
325
- +----------+
326
- | bobby |
327
- | devdojo |
328
- | tony |
329
- | bobby |
330
- | devdojo |
331
- | tony |
332
- +----------+
333
- ```
334
-
335
- As you can see, each name is present multiple times in the list. We have `bobby`, `devdjo` and `tony` showing up twice.
336
-
337
- If we wanted to show only the unique `usernames`, we could add the `DISTINCT` keyword to our select statement:
338
-
339
- ```sql
340
- SELECT DISTINCT username FROM users;
341
- ```
342
-
343
- Output:
344
-
345
- ```
346
- +----------+
347
- | username |
348
- +----------+
349
- | bobby |
350
- | devdojo |
351
- | tony |
352
- +----------+
353
- ```
354
-
355
- As you can see, the duplicate entries have been removed from the output.
356
-
357
- ## Conclusion
358
-
359
- The `SELECT` statement is essential whenever working with SQL. In the next chapter, we are going to learn how to use the `WHERE` clause and take the `SELECT` statements to the next level.
@@ -1,225 +0,0 @@
1
- # WHERE
2
-
3
- The `WHERE` clause allows you to specify different conditions so that you could filter out the data and get a specific result set.
4
-
5
- You would add the `WHERE` clause after the `FROM` clause.
6
-
7
- The syntax would look like this:
8
-
9
- ```sql
10
- SELECT column_name FROM table_name WHERE column=some_value;
11
- ```
12
-
13
- ## WHERE Clause example
14
-
15
- If we take the example `users` table from the last chapter, let's say that we wanted to get only the active users. The SQL statement would look like this:
16
-
17
- ```sql
18
- SELECT DISTINCT username, email, activem FROM users WHERE active=true;
19
- ```
20
-
21
- Output:
22
-
23
- ```
24
- +----------+---------------+--------+
25
- | username | email | active |
26
- +----------+---------------+--------+
27
- | bobby | b@devdojo.com | 1 |
28
- | tony | t@devdojo.com | 1 |
29
- +----------+---------------+--------+
30
- ```
31
-
32
- As you can see, we are only getting `tony` and `bobby` back as their `active` column is `true` or `1`. If we wanted to get the inactive users, we would have to change the `WHERE` clause and set the `active` to `false`:
33
-
34
- ```
35
- +----------+---------------+--------+
36
- | username | email | active |
37
- +----------+---------------+--------+
38
- | devdojo | d@devdojo.com | 0 |
39
- +----------+---------------+--------+
40
- ```
41
-
42
- As another example, let's say that we wanted to select all users with the username `bobby`. The query, in this case, would be:
43
-
44
- ```sql
45
- SELECT username, email, active FROM users WHERE username='bobby';
46
- ```
47
-
48
- The output would look like this:
49
-
50
- ```
51
- +----------+---------------+--------+
52
- | username | email | active |
53
- +----------+---------------+--------+
54
- | bobby | b@devdojo.com | 1 |
55
- | bobby | b@devdojo.com | 1 |
56
- +----------+---------------+--------+
57
- ```
58
-
59
- We are getting 2 entries back as we have 2 users in our database with the username `bobby`.
60
-
61
- ## Operators
62
-
63
- In the example, we used the `=` operator, which checks if the result set matches the value that we are looking for.
64
-
65
- A list of popular operators are:
66
-
67
- * `!=` : Not equal operator
68
- * `>` : Greater than
69
- * `>=` : Greater than or equal operator
70
- * `<` : Less than operator
71
- * `<=` : Less than or equal operator
72
-
73
- For more information about other available operators, make sure to check the official documentation [here](https://dev.mysql.com/doc/refman/8.0/en/non-typed-operators.html).
74
-
75
- ## AND keyword
76
-
77
- In some cases, you might want to specify multiple criteria. For example, you might want to get all users that are active, and the username matches a specific value. This could be achieved with the `AND` keyword.
78
-
79
- Syntax:
80
-
81
- ```sql
82
- SELECT * FROM users WHERE username='bobby' AND active=true;
83
- ```
84
-
85
- The result set would contain the data that matches both conditions. In our case, the output would be:
86
-
87
- ```
88
- +----+----------+-------+----------+--------+---------------+
89
- | id | username | about | birthday | active | email |
90
- +----+----------+-------+----------+--------+---------------+
91
- | 2 | bobby | NULL | NULL | 1 | b@devdojo.com |
92
- | 5 | bobby | NULL | NULL | 1 | b@devdojo.com |
93
- +----+----------+-------+----------+--------+---------------+
94
- ```
95
-
96
- If we were to change the `AND` statement to `active=false`, we would not get any results back as none of the entries in our database match that condition:
97
-
98
- ```sql
99
- SELECT * FROM users WHERE username='bobby' AND active=false;
100
- ```
101
- ```
102
- -- Output:
103
- Empty set (0.01 sec)
104
- ```
105
-
106
- ## OR keyword
107
-
108
- In some cases, you might want to specify multiple criteria. For example, you might want to get all users that are active, or their username matches a specific value. This could be achieved with the `OR` keyword.
109
-
110
- As with any other programming language, the main difference between `AND` and `OR` is that with `AND`, the result would only return the values that match the two conditions, and with `OR`, you would get a result that matches either of the conditions.
111
-
112
- For example, if we were to run the same query as above but change the `AND` to `OR`, we would get all users that have the username `bobby` and also all users that are not active:
113
-
114
- ```sql
115
- SELECT * FROM users WHERE username='bobby' OR active=false;
116
- ```
117
-
118
- Output:
119
-
120
- ```
121
- +----+----------+-------+----------+--------+---------------+
122
- | id | username | about | birthday | active | email |
123
- +----+----------+-------+----------+--------+---------------+
124
- | 2 | bobby | NULL | NULL | 1 | b@devdojo.com |
125
- | 3 | devdojo | NULL | NULL | 0 | d@devdojo.com |
126
- | 5 | bobby | NULL | NULL | 1 | b@devdojo.com |
127
- | 6 | devdojo | NULL | NULL | 0 | d@devdojo.com |
128
- +----+----------+-------+----------+--------+---------------+
129
- ```
130
-
131
- ## LIKE operator
132
-
133
- Unlike the `=` operator, the `LIKE` operator allows you to do wildcard matching similar to the `*` symbol in Linux.
134
-
135
- For example, if you wanted to get all users that have the `y` letter in them, you would run the following:
136
-
137
- ```sql
138
- SELECT * FROM users WHERE username LIKE '%y%';
139
- ```
140
-
141
- Output
142
-
143
- ```
144
- +----+----------+-------+----------+--------+---------------+
145
- | id | username | about | birthday | active | email |
146
- +----+----------+-------+----------+--------+---------------+
147
- | 2 | bobby | NULL | NULL | 1 | b@devdojo.com |
148
- | 4 | tony | NULL | NULL | 1 | t@devdojo.com |
149
- +----+----------+-------+----------+--------+---------------+
150
- ```
151
-
152
- As you can see, we are getting only `tony` and `bobby` but not `devdojo` as there is no `y` in `devdojo`.
153
-
154
- This is quite handy when you are building some search functionality for your application.
155
-
156
- # IN operator
157
-
158
- The `IN` operator allows you to provide a list expression and would return the results that match that list of values.
159
-
160
- For example, if you wanted to get all users that have the username `bobby` and `devdojo`, you could use the following:
161
-
162
- ```sql
163
- SELECT * FROM users WHERE username IN ('bobby', 'devdojo');
164
- ```
165
-
166
- Output:
167
-
168
- ```
169
- +----+----------+-------+----------+--------+---------------+
170
- | id | username | about | birthday | active | email |
171
- +----+----------+-------+----------+--------+---------------+
172
- | 2 | bobby | NULL | NULL | 1 | b@devdojo.com |
173
- | 3 | devdojo | NULL | NULL | 0 | d@devdojo.com |
174
- | 5 | bobby | NULL | NULL | 1 | b@devdojo.com |
175
- | 6 | devdojo | NULL | NULL | 0 | d@devdojo.com |
176
- +----+----------+-------+----------+--------+---------------+
177
- ```
178
-
179
- This allows you to simplify your `WHERE` expression so that you don't have to add numerous `OR` statements.
180
-
181
- ## IS operator
182
-
183
- If you were to run `SELECT * FROM users WHERE about=NULL;` you would get an empty result set as the `=` operator can't be used to check for NULL values. Instead, you would need to use the `IS` operator instead.
184
-
185
- The `IS` operator is only used to check `NULL` values, and the syntax is the following:
186
-
187
- ```sql
188
- SELECT * FROM users WHERE about IS NULL;
189
- ```
190
-
191
- If you wanted to get the results where the value is not NULL, you just need to change `IS` to `IS NOT`:
192
-
193
-
194
- ```sql
195
- SELECT * FROM users WHERE about IS NOT NULL;
196
- ```
197
-
198
- ## BETWEEN operator
199
-
200
- The `BETWEEN` operator allows to select value with a given range.The values can be numbers, text, or dates.
201
- BETWEEN operator is inclusive: begin and end values are included.
202
-
203
- For Example if you want to select those user which have id between 3 and 6.
204
-
205
- ```sql
206
- SELECT * FROM users WHERE id BETWEEN 3 AND 6;
207
- ```
208
-
209
- Output:
210
-
211
- ```
212
- +----+----------+-------+----------+--------+---------------+
213
- | id | username | about | birthday | active | email |
214
- +----+----------+-------+----------+--------+---------------+
215
- | 3 | devdojo | NULL | NULL | 0 | d@devdojo.com |
216
- | 5 | bobby | NULL | NULL | 1 | b@devdojo.com |
217
- | 6 | devdojo | NULL | NULL | 0 | d@devdojo.com |
218
- +----+----------+-------+----------+--------+---------------+
219
- ```
220
-
221
- ## Conclusion
222
-
223
- In this chapter, you've learned how to use the `WHERE` clause with different operators to get different type of results based on the parameters that you provide.
224
-
225
- In the next chapter, we will learn how to order the result set.