# SupportSQLiteQueryBuilder

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact android.arch.persistence:db:1.1.0-beta2  
Summary:[Methods](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#inhmethods)  

# SupportSQLiteQueryBuilder

| The`android.arch`Architecture Components packages are no longer maintained. They have been superseded by the corresponding[androidx.\*](https://developer.android.com/jetpack/androidx/migrate)packages. See[androidx.sqlite.db.SupportSQLiteQueryBuilder](https://developer.android.com/reference/androidx/sqlite/db/SupportSQLiteQueryBuilder)instead.

`
public

final

class
SupportSQLiteQueryBuilder
`  
`

extends Object


``


`

|---|-------------------------------------------------------|
| java.lang.Object                                         ||
| ↳ | android.arch.persistence.db.SupportSQLiteQueryBuilder |

<br />

*** ** * ** ***

A simple query builder to create SQL SELECT queries.

## Summary

|                                                                                                                                                                                                                                                                                     ### Public methods                                                                                                                                                                                                                                                                                     ||
|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | ` `[builder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#builder(java.lang.String))`(String tableName) ` Creates a query for the given table name.                                                                                                                                                                                                                                                 |
| ` `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)        | ` `[columns](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#columns(java.lang.String[]))`(String[] columns) ` Sets the given list of columns as the columns that will be returned.                                                                                                                                                                                                                    |
| ` `[SupportSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQuery)                      | ` `[create](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#create())`() ` Creates the[SupportSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQuery)that can be passed into[query(SupportSQLiteQuery)](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteDatabase#query(android.arch.persistence.db.SupportSQLiteQuery)). |
| ` `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)        | ` `[distinct](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#distinct())`() ` Adds DISTINCT keyword to the query.                                                                                                                                                                                                                                                                                     |
| ` `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)        | ` `[groupBy](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#groupBy(java.lang.String))`(String groupBy) ` Adds a GROUP BY statement.                                                                                                                                                                                                                                                                  |
| ` `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)        | ` `[having](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#having(java.lang.String))`(String having) ` Adds a HAVING statement.                                                                                                                                                                                                                                                                       |
| ` `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)        | ` `[limit](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#limit(java.lang.String))`(String limit) ` Adds a LIMIT statement.                                                                                                                                                                                                                                                                           |
| ` `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)        | ` `[orderBy](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#orderBy(java.lang.String))`(String orderBy) ` Adds an ORDER BY statement.                                                                                                                                                                                                                                                                 |
| ` `[SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)        | ` `[selection](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#selection(java.lang.String, java.lang.Object[]))`(String selection, Object[] bindArgs) ` Sets the arguments for the WHERE clause.                                                                                                                                                                                                       |

| ### Inherited methods |
|-----------------------|---|
| From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### builder

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder builder (String tableName)
```

Creates a query for the given table name.

<br />

|                        Parameters                         ||
|-------------|----------------------------------------------|
| `tableName` | `String`: The table name(s) to query. <br /> |

|                                                                             Returns                                                                             ||
|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | A builder to create a query. <br /> |

### columns

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder columns (String[] columns)
```

Sets the given list of columns as the columns that will be returned.

<br />

|                                  Parameters                                   ||
|-----------|--------------------------------------------------------------------|
| `columns` | `String`: The list of column names that should be returned. <br /> |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|-------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | this <br /> |

### create

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQuery create ()
```

Creates the[SupportSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQuery)that can be passed into[query(SupportSQLiteQuery)](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteDatabase#query(android.arch.persistence.db.SupportSQLiteQuery)).

<br />

|                                                             Returns                                                              ||
|--------------------------------------------------------------------------------------------------------------|--------------------|
| [SupportSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQuery) | a new query <br /> |

### distinct

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder distinct ()
```

Adds DISTINCT keyword to the query.

<br />

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|-------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | this <br /> |

### groupBy

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder groupBy (String groupBy)
```

Adds a GROUP BY statement.

<br />

|                            Parameters                            ||
|-----------|-------------------------------------------------------|
| `groupBy` | `String`: The value of the GROUP BY statement. <br /> |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|-------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | this <br /> |

### having

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder having (String having)
```

Adds a HAVING statement. You must also provide[groupBy(String)](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder#groupBy(java.lang.String))for this to work.

<br />

|                  Parameters                   ||
|----------|-------------------------------------|
| `having` | `String`: The having clause. <br /> |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|-------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | this <br /> |

### limit

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder limit (String limit)
```

Adds a LIMIT statement.

<br />

|                 Parameters                 ||
|---------|-----------------------------------|
| `limit` | `String`: The limit value. <br /> |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|-------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | this <br /> |

### orderBy

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder orderBy (String orderBy)
```

Adds an ORDER BY statement.

<br />

|                  Parameters                   ||
|-----------|------------------------------------|
| `orderBy` | `String`: The order clause. <br /> |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|-------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | this <br /> |

### selection

added in[version 1.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
SupportSQLiteQueryBuilder selection (String selection, 
                Object[] bindArgs)
```

Sets the arguments for the WHERE clause.

<br />

|                                       Parameters                                        ||
|-------------|----------------------------------------------------------------------------|
| `selection` | `String`: The list of selection columns <br />                             |
| `bindArgs`  | `Object`: The list of bind arguments to match against these columns <br /> |

|                                                                 Returns                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------|-------------|
| [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder) | this <br /> |

-

  ## Interfaces

  - [SupportSQLiteDatabase](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteDatabase)
  - [SupportSQLiteOpenHelper](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper)
  - [SupportSQLiteOpenHelper.Factory](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Factory)
  - [SupportSQLiteProgram](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteProgram)
  - [SupportSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQuery)
  - [SupportSQLiteStatement](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteStatement)
-

  ## Classes

  - [SimpleSQLiteQuery](https://developer.android.com/reference/android/arch/persistence/db/SimpleSQLiteQuery)
  - [SupportSQLiteOpenHelper.Callback](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Callback)
  - [SupportSQLiteOpenHelper.Configuration](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Configuration)
  - [SupportSQLiteOpenHelper.Configuration.Builder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteOpenHelper.Configuration.Builder)
  - [SupportSQLiteQueryBuilder](https://developer.android.com/reference/android/arch/persistence/db/SupportSQLiteQueryBuilder)