@@ -24,8 +24,9 @@ An elegant lightweight and efficient SQL Query Builder with fluid interface SQL
24
24
* [3.3.1. Basic UPDATE statement](#block3.3.1)
25
25
* [3.3.2. Elaborated UPDATE statement](#block3.3.2)
26
26
* [3.4. DELETE Statement](#block3.4)
27
- * [3.4.1. Basic DELETE statement](#block3.4.1)
28
- * [3.4.2. Elaborated DELETE statement](#block3.4.2)
27
+ * [3.4.1. Empty table with DELETE statement](#block3.4.1)
28
+ * [3.4.2. Basic DELETE statement](#block3.4.2)
29
+ * [3.4.3. Elaborated DELETE statement](#block3.4.3)
29
30
* [ 4. Advanced Quering] ( #block4 )
30
31
* [4.1. Filtering using WHERE](#block4.1)
31
32
* [4.1.1. Changing WHERE logical operator](#block4.2)
@@ -99,7 +100,7 @@ SELECT user.* FROM `user`
99
100
```
100
101
101
102
<a name =" block2.3 " ></a >
102
- ### 2.3. Human Readable Output [ ↑] ( #index_block )
103
+ #### 2.3. Human Readable Output [ ↑] ( #index_block )
103
104
104
105
Both Generic and MySQL Query Builder can write complex SQL queries.
105
106
@@ -139,7 +140,7 @@ More complicated examples can be found in the documentation.
139
140
140
141
141
142
<a name =" block3.1.1 " ></a >
142
- ### 3.1.1. Basic SELECT statement [ ↑] ( #index_block )
143
+ #### 3.1.1. Basic SELECT statement [ ↑] ( #index_block )
143
144
#### Usage:
144
145
``` php
145
146
<?php
@@ -159,7 +160,7 @@ SELECT user.user_id, user.name, user.email FROM user
159
160
```
160
161
161
162
<a name =" block3.1.2 " ></a >
162
- ### 3.1.2. Aliased SELECT statement [ ↑] ( #index_block )
163
+ #### 3.1.2. Aliased SELECT statement [ ↑] ( #index_block )
163
164
164
165
#### Usage:
165
166
``` php
@@ -179,7 +180,7 @@ echo $builder->write($query);
179
180
SELECT user .user_id AS userId, user .name AS username, user .email AS email FROM user
180
181
```
181
182
<a name =" block3.1.3 " ></a >
182
- #### 3.1.3. SELECT with WHERE statement
183
+ #### 3.1.3. SELECT with WHERE statement [ ↑ ] ( #index_block )
183
184
184
185
Default logical operator for filtering using ` WHERE ` conditions is ` AND ` .
185
186
@@ -217,7 +218,7 @@ WHERE
217
218
```
218
219
219
220
<a name =" block3.1.4 " ></a >
220
- #### 3.1.4. Complex WHERE conditions
221
+ #### 3.1.4. Complex WHERE conditions [ ↑ ] ( #index_block )
221
222
222
223
#### Usage:
223
224
``` php
@@ -254,7 +255,7 @@ WHERE
254
255
```
255
256
256
257
<a name =" block3.1.5 " ></a >
257
- #### 3.1.5. JOIN & LEFT/RIGHT/INNER/CROSS JOIN SELECT statements
258
+ #### 3.1.5. JOIN & LEFT/RIGHT/INNER/CROSS JOIN SELECT statements [ ↑ ] ( #index_block )
258
259
259
260
Syntax for ` JOIN ` , ` LEFT JOIN ` , ` RIGHT JOIN ` , ` INNER JOIN ` , ` CROSS JOIN ` work the exactly same way.
260
261
@@ -327,7 +328,7 @@ ORDER BY
327
328
The ` INSERT ` statement is really straightforward.
328
329
329
330
<a name =" block3.3.1 " ></a >
330
- ### 3.2.1 Basic INSERT statement [ ↑] ( #index_block )
331
+ #### 3.2.1 Basic INSERT statement [ ↑] ( #index_block )
331
332
332
333
#### Usage:
333
334
``` php
@@ -367,7 +368,7 @@ The `UPDATE` statement works just like expected, set the values and the conditio
367
368
Examples provided below.
368
369
369
370
<a name =" block3.3.1 " ></a >
370
- ### 3.3.1 Basic UPDATE statement [ ↑] ( #index_block )
371
+ #### 3.3.1 Basic UPDATE statement [ ↑] ( #index_block )
371
372
Important including the the ` where ` statement is critical, or all table rows will be replaced with the provided values if the statement is executed.
372
373
373
374
#### Usage:
@@ -406,7 +407,7 @@ WHERE
406
407
[':v1' => 1, ':v2' => 'Nil', ':v3' => 'contact@nilportugues.com', ':v4' => 1];
407
408
```
408
409
<a name =" block3.3.2 " ></a >
409
- ### 3.3.2. Elaborated UPDATE statement [ ↑] ( #index_block )
410
+ #### 3.3.2. Elaborated UPDATE statement [ ↑] ( #index_block )
410
411
411
412
#### Usage:
412
413
``` php
@@ -457,7 +458,28 @@ The `DELETE` statement is used just like `UPDATE`, but no values are set.
457
458
Examples provided below.
458
459
459
460
<a name =" block3.4.1 " ></a >
460
- ### 3.4.1. Basic DELETE statement [ ↑] ( #index_block )
461
+ #### 3.4.1. Empty table with DELETE statement [ ↑] ( #index_block )
462
+
463
+ #### Usage:
464
+ ``` php
465
+ <?php
466
+ use NilPortugues\SqlQueryBuilder\Manipulation\Delete;
467
+ use NilPortugues\SqlQueryBuilder\Builder\GenericBuilder;
468
+
469
+ $query = (new Delete())
470
+ ->setTable('user');
471
+
472
+ $builder = new GenericBuilder();
473
+
474
+ $sql = $builder->write($query);
475
+ ```
476
+ #### Output:
477
+ ``` sql
478
+ DELETE FROM user
479
+ ```
480
+
481
+ <a name =" block3.4.2 " ></a >
482
+ #### 3.4.2. Basic DELETE statement [ ↑] ( #index_block )
461
483
Important including the the ` where ` statement is critical, or all table rows will be deleted with the provided values if the statement is executed.
462
484
463
485
#### Usage:
@@ -489,7 +511,7 @@ DELETE FROM user WHERE (user.user_id = :v1) LIMIT :v2
489
511
[':v1' => 100, ':v2' => 1];
490
512
```
491
513
<a name =" block3.4.2 " ></a >
492
- ### 3.4.2. Elaborated DELETE statement [ ↑] ( #index_block )
514
+ #### 3.4.2. Elaborated DELETE statement [ ↑] ( #index_block )
493
515
494
516
#### Usage:
495
517
``` php
0 commit comments