Skip to content

Commit 52627fb

Browse files
committed
Update README.md
1 parent 808cd55 commit 52627fb

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

README.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ An elegant lightweight and efficient SQL Query Builder with fluid interface SQL
2424
* [3.3.1. Basic UPDATE statement](#block3.3.1)
2525
* [3.3.2. Elaborated UPDATE statement](#block3.3.2)
2626
* [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)
2930
* [4. Advanced Quering](#block4)
3031
* [4.1. Filtering using WHERE](#block4.1)
3132
* [4.1.1. Changing WHERE logical operator](#block4.2)
@@ -99,7 +100,7 @@ SELECT user.* FROM `user`
99100
```
100101

101102
<a name="block2.3"></a>
102-
### 2.3. Human Readable Output [](#index_block)
103+
#### 2.3. Human Readable Output [](#index_block)
103104

104105
Both Generic and MySQL Query Builder can write complex SQL queries.
105106

@@ -139,7 +140,7 @@ More complicated examples can be found in the documentation.
139140

140141

141142
<a name="block3.1.1"></a>
142-
### 3.1.1. Basic SELECT statement [](#index_block)
143+
#### 3.1.1. Basic SELECT statement [](#index_block)
143144
#### Usage:
144145
```php
145146
<?php
@@ -159,7 +160,7 @@ SELECT user.user_id, user.name, user.email FROM user
159160
```
160161

161162
<a name="block3.1.2"></a>
162-
### 3.1.2. Aliased SELECT statement [](#index_block)
163+
#### 3.1.2. Aliased SELECT statement [](#index_block)
163164

164165
#### Usage:
165166
```php
@@ -179,7 +180,7 @@ echo $builder->write($query);
179180
SELECT user.user_id AS userId, user.name AS username, user.email AS email FROM user
180181
```
181182
<a name="block3.1.3"></a>
182-
#### 3.1.3. SELECT with WHERE statement
183+
#### 3.1.3. SELECT with WHERE statement [](#index_block)
183184

184185
Default logical operator for filtering using `WHERE` conditions is `AND`.
185186

@@ -217,7 +218,7 @@ WHERE
217218
```
218219

219220
<a name="block3.1.4"></a>
220-
#### 3.1.4. Complex WHERE conditions
221+
#### 3.1.4. Complex WHERE conditions [](#index_block)
221222

222223
#### Usage:
223224
```php
@@ -254,7 +255,7 @@ WHERE
254255
```
255256

256257
<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)
258259

259260
Syntax for `JOIN`, `LEFT JOIN`, `RIGHT JOIN`, `INNER JOIN`, `CROSS JOIN` work the exactly same way.
260261

@@ -327,7 +328,7 @@ ORDER BY
327328
The `INSERT` statement is really straightforward.
328329

329330
<a name="block3.3.1"></a>
330-
### 3.2.1 Basic INSERT statement [](#index_block)
331+
#### 3.2.1 Basic INSERT statement [](#index_block)
331332

332333
#### Usage:
333334
```php
@@ -367,7 +368,7 @@ The `UPDATE` statement works just like expected, set the values and the conditio
367368
Examples provided below.
368369

369370
<a name="block3.3.1"></a>
370-
### 3.3.1 Basic UPDATE statement [](#index_block)
371+
#### 3.3.1 Basic UPDATE statement [](#index_block)
371372
Important including the the `where` statement is critical, or all table rows will be replaced with the provided values if the statement is executed.
372373

373374
#### Usage:
@@ -406,7 +407,7 @@ WHERE
406407
[':v1' => 1, ':v2' => 'Nil', ':v3' => 'contact@nilportugues.com', ':v4' => 1];
407408
```
408409
<a name="block3.3.2"></a>
409-
### 3.3.2. Elaborated UPDATE statement [](#index_block)
410+
#### 3.3.2. Elaborated UPDATE statement [](#index_block)
410411

411412
#### Usage:
412413
```php
@@ -457,7 +458,28 @@ The `DELETE` statement is used just like `UPDATE`, but no values are set.
457458
Examples provided below.
458459

459460
<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)
461483
Important including the the `where` statement is critical, or all table rows will be deleted with the provided values if the statement is executed.
462484

463485
#### Usage:
@@ -489,7 +511,7 @@ DELETE FROM user WHERE (user.user_id = :v1) LIMIT :v2
489511
[':v1' => 100, ':v2' => 1];
490512
```
491513
<a name="block3.4.2"></a>
492-
### 3.4.2. Elaborated DELETE statement [](#index_block)
514+
#### 3.4.2. Elaborated DELETE statement [](#index_block)
493515

494516
#### Usage:
495517
```php

0 commit comments

Comments
 (0)