Skip to content

Commit

Permalink
Update documentation to include except keyword (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvsweeney9 committed Jul 18, 2023
1 parent 7702d42 commit 1e5da7f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/guide/query-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,40 @@ knex.select('*')
)
```

### except

**.except([\*queries], [wrap])**

Creates an except query, taking an array or a list of callbacks, builders, or raw statements to build the except statement, with optional boolean wrap. If the `wrap` parameter is `true`, the queries will be individually wrapped in parentheses. The except method is unsupported on MySQL.

```js
knex.select('*')
.from('users')
.whereNull('last_name')
.except(function() {
this.select('*').from('users').whereNull('first_name')
})

knex.select('*')
.from('users')
.whereNull('last_name')
.except([
knex.select('*').from('users').whereNull('first_name')
])

knex.select('*')
.from('users')
.whereNull('last_name')
.except(
knex.raw(
'select * from users where first_name is null'
),
knex.raw(
'select * from users where email is null'
)
)
```

### insert

**.insert(data, [returning], [options])**
Expand Down

0 comments on commit 1e5da7f

Please sign in to comment.