# Select by Id

## **Overview**

Selecting records by ID is a common operation when you want to retrieve specific rows based on their unique identifier. QueryDeck provides a straightforward way to implement this via the "select by id" method.

## Creating a select by ID Query

Create a new API and you will see the following template page

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2Fx0EIemVQqPwAf3zovvH2%2Fimage.png?alt=media&#x26;token=6f542335-70f7-41ce-be6b-50047f84d210" alt=""><figcaption></figcaption></figure>

Choose the desired table you would like to work on

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2FajCUrVpDOkVa1x8LGKcm%2Fimage.png?alt=media&#x26;token=685614a9-e693-4476-ae11-4a400ffb3c1e" alt=""><figcaption></figcaption></figure>

Then choose the method as "select by id"

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2F6bBD53BZnuj0ZCvD4SFl%2Fimage.png?alt=media&#x26;token=0df02fd8-533f-4b5d-ad42-b05f55e08c52" alt=""><figcaption></figcaption></figure>

click on the save button on the top right to save the API changes made

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2Fjq6IFBapfJjUnGlX4DqH%2Fimage.png?alt=media&#x26;token=b66e26bc-44d4-43a5-aed5-ccae90471076" alt=""><figcaption></figcaption></figure>

## Testing the endpoint URL

Then click on the endpoint URL to copy it from the top right region

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2FnJxHj01Ld6hhGiVzVTpf%2Fimage.png?alt=media&#x26;token=cc2b5026-d7f1-420d-9337-a70a4828053f" alt=""><figcaption></figcaption></figure>

Open postman and paste the url in the input bar

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2F6ZY6rbdzZEVn0EHHyLts%2Fimage.png?alt=media&#x26;token=9eaeb080-400d-46d3-a498-0e6d81d0fe54" alt=""><figcaption></figcaption></figure>

Replace :customer\_id with the customer id you want to display

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2FnOeADqfOcUv3bjhIIVk3%2Fimage.png?alt=media&#x26;token=692718b1-d7a5-4153-97b6-b6222dd7ae80" alt=""><figcaption></figcaption></figure>

Hit send to send the request

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2FM9QCnmAm0jkOp8upjS4T%2Fimage.png?alt=media&#x26;token=b0dcaa23-6d2f-4383-8894-c48f0957dadf" alt=""><figcaption></figcaption></figure>

You should obtain the corresponding response displaying the row with customer\_id = 12

<figure><img src="https://1803924624-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkjtTl1rn3hJ3jyoJt6ty%2Fuploads%2FOpljYbmO9Mtajxvs63qZ%2Fimage.png?alt=media&#x26;token=3f3c675d-2edf-419d-9a40-380826a827a9" alt=""><figcaption></figcaption></figure>
