Query All Records
Simple Query
Get all records from a tableCustom Queries
Joins
Sorting
Evals
Customizing the Response
Return Options
Return Type
Returns are defined using thereturn parameter with type and configuration options.
-
exists - Returns true/false if records exist
-
-
count - Returns the number of records found
-
-
single - Returns the first record found
-
-
list - Returns an array of records
-
-
stream - Returns records for efficient iteration
-
Return any user records with an ID that matches the input userId
Return any user records with an ID that matches the input userId that are also admins
Get Record
Simple query
Customizing the Response
Get a record by ID
Has Record
Example

Add Record
Create a new user record
Edit Record
Edits the contents of an existing record in the database by specifying the target record and the data to update.Update a user's name and list
Update specific fields in a product record
💡 The function will only update the fields specified in the data object. Other fields in the record will remain unchanged.
Notes
- You must specify which record to update using
field_nameandfield_value - The
dataobject should only include the fields you want to update - You can reference input variables (
$input) or other variables in your data object - The updated record will be returned in the variable specified after
as
Add or Edit Record
Update or create user profile
Delete Record
Delete inactive user
Patch Record
Update only the last_login field
Bulk Operations
Bulk Add Users
Bulk Update Users
Bulk Patch Users
Bulk Delete Users
💡 Bulk operations are more efficient than performing multiple individual operations when working with multiple records.Notes
- All operations return the affected record(s) in the variable specified after
as - Bulk operations can significantly improve performance when working with multiple records
- The
field_nameandfield_valuecombination is used to identify specific records - Patch operations are useful when you want to update specific fields without affecting others
- The
|set:operator in patch operations allows you to update only specified fields, leaving others unchanged. For example,data = {}|set:"name":$input.namewill only update thenamefield in the record. - Always use valid table and field names as defined in your Xano database.
- You can reference input variables (
$input) or other variables in your data object for dynamic updates. - For best performance, prefer bulk operations when working with many records instead of looping single operations.
Direct Database Query
If you’re using a prepared statement (with
? placehholders), you can pass in arguments using the arg parameter, as shown below in the examples.
Examples
Database Transaction
Example
Clear All Records
Get Database Schema
Example
External Database Queries
- External MSSQL Query
- External MySQL Query
- External PostgreSQL Query
- External Oracle Query
db.direct_query statement shown above, but are used to connect to external databases configured in your Xano workspace settings and have an additional connection_string parameter to specify how to connect to the external database.