Community Support Log in
Start for Free
    • Welcome
    • Learn
      • Introduction
        • What is Fauna?
        • What is a document-relational database?
        • Key Concepts
        • Data model, querying, and security
        • Plan your application
        • FQL for SQL users
      • Quick start
        • Dashboard
        • GraphQL
        • Client application
      • Understanding Fauna
        • Databases
        • Collections
        • Documents
        • Indexes
        • User-defined functions
        • Event streaming
        • Temporality
        • Data types
        • Region Groups
        • Backups
        • Isolation levels
        • Billing
        • Limits
      • Sample apps
        • Fwitter
      • Tutorials
        • FQL
          • CRUD
          • FQL basics
            • Indexes
            • Data modeling
            • Functions
            • Authentication and authorization
          • Indexes
            • Pagination
            • Sort
            • Search
            • Search and sort
            • Bindings
          • Authentication
            • User authentication
            • Attribute-based access control (ABAC)
          • Temporality
          • Multi-tenancy
          • Social graph
          • E-commerce
          • Write throughput scaling
          • Combination field filtering
        • GraphQL
          • Relations
            • One-to-many self-referential relations
            • Many-to-many self-referential relations
          • Unique constraints
          • Pagination
          • User-defined functions
      • Cookbook
        • FQL
          • Basics
            • Collections
              • Create
              • Create a document
              • Create many documents
              • Delete
              • Get
              • List
              • Metadata
              • Rename
            • Databases
              • Create
              • Delete
              • Get
              • List
              • Metadata
              • Rename
            • Documents
              • Reference
              • Create
              • Create many
              • Upsert
            • Functions
              • Call
              • Create
              • Delete
              • Get
              • List
              • Metadata
              • Rename
            • Indexes
              • Create
              • Delete
              • Get
              • List
              • Query
              • Metadata
              • Rename
            • Keys
              • Create
              • Delete
              • Get
              • List
              • Metadata
            • Tokens
              • Create
              • Delete
              • Get
              • List
              • Metadata
          • Array
            • Zip together two arrays
          • Math
            • Unsigned integer subtraction
          • Search
            • List of terms
            • Missing field value
            • Null field
            • Duplicate values
            • List of terms using a UDF
            • Search a date range
          • Strings
            • Split a string by a delimiter
        • GraphQL
          • GraphQL counter
          • Sorting GraphQL results
          • Search a date range
          • Composable Types without Unions
            • Model Unions as a single type
            • Model Unions as sparse fields
            • A "Component" pattern for GraphQL
    • Build
      • Developing with FQL
        • Fauna drivers
          • C#
          • Go
          • Java
          • JavaScript
          • Python
          • Scala
        • Basic CRUD operations
        • Query composition
        • Working with data types
        • Indexes
          • Index terms
          • Values
          • Bindings
          • Pagination
          • Multi-collection indexes
          • Temporality and indexes
          • Combining and comparing result sets
        • User-defined functions
        • Using temporality
        • Error handling
      • Best practices
        • Database performance
        • Defensive query strategies
        • HTTP timeouts
        • Indexes
        • Security
      • Tools
        • Fauna Dashboard
          • Multi-factor authentication
          • Team management
        • Fauna Dev
        • fauna-shell
          • Configuration
          • Commands
            • add-endpoint
            • autocomplete
            • cloud-login
            • create-database
            • create-key
            • default-endpoint
            • delete-database
            • delete-endpoint
            • delete-key
            • eval
            • help
            • import
            • list-databases
            • list-endpoints
            • list-keys
            • shell
            • upload-graphql-schema
          • Logins for GitHub or Netlify users
        • VS Code extension
      • Logs
        • Query log
          • Dashboard operations
          • API automation
          • Reference
            • /api/v1/logs
            • /api/v1/logs/{requestId}
            • /api/v1/logs/{request_id}/url
            • /api/v1/logs/_list
            • Log record format
      • Integrations
        • Airbyte
        • Appsmith
        • Cloudflare Workers
        • Fastly Compute@Edge
        • Netlify Add-on
        • Retool
        • Vercel integration
        • WunderGraph
    • API references
      • GraphQL
        • Endpoints
        • Error responses
        • Directives
          • @collection
          • @embedded
          • @generateUDFResolvers
          • @index
          • @relation
          • @resolver
          • @unique
        • Schemas
        • Input types
        • Relationships
        • User-defined functions
      • FQL
        • FQL cheat sheet
        • Indexes
        • Deprecations
        • Known issues
        • Built-in functions
          • Abort
          • Abs
          • AccessProvider
          • AccessProviders
          • Acos
          • Add
          • All
          • And
          • Any
          • Append
          • Asin
          • At
          • Atan
          • BitAnd
          • BitNot
          • BitOr
          • BitXor
          • Call
          • Casefold
          • Ceil
          • Class
          • Classes
          • Collection
          • Collections
          • Concat
          • Contains
          • ContainsField
          • ContainsPath
          • ContainsStr
          • ContainsStrRegex
          • ContainsValue
          • Cos
          • Cosh
          • Count
          • Create
          • CreateAccessProvider
          • CreateClass
          • CreateCollection
          • CreateDatabase
          • CreateFunction
          • CreateIndex
          • CreateKey
          • CreateRole
          • Credentials
          • CurrentIdentity
          • CurrentToken
          • Database
          • Databases
          • Date
          • DayOfMonth
          • DayOfWeek
          • DayOfYear
          • Degrees
          • Delete
          • Difference
          • Distinct
          • Divide
          • Do
          • Documents
          • Drop
          • EndsWith
          • Epoch
          • Equals
          • Events
          • Exists
          • Exp
          • Filter
          • FindStr
          • FindStrRegex
          • Floor
          • Foreach
          • Format
          • Function
          • Functions
          • GT
          • GTE
          • Get
          • HasCurrentIdentity
          • HasIdentity
          • HasCurrentToken
          • Hour
          • Hypot
          • Identify
          • Identity
          • If
          • Index
          • Indexes
          • Insert
          • Intersection
          • IsArray
          • IsBoolean
          • IsBytes
          • IsCollection
          • IsCredentials
          • IsDatabase
          • IsDate
          • IsDoc
          • IsDouble
          • IsEmpty
          • IsFunction
          • IsIndex
          • IsInteger
          • IsKey
          • IsLambda
          • IsNonEmpty
          • IsNull
          • IsNumber
          • IsObject
          • IsRef
          • IsRole
          • IsSet
          • IsString
          • IsTimestamp
          • IsToken
          • Join
          • KeyFromSecret
          • Keys
          • LT
          • LTE
          • LTrim
          • Lambda
          • Length
          • Let
          • Ln
          • Log
          • Login
          • Logout
          • LowerCase
          • Map
          • Match
          • Max
          • Mean
          • Merge
          • Min
          • Minute
          • Modulo
          • Month
          • MoveDatabase
          • Multiply
          • NewId
          • Not
          • Now
          • Or
          • Paginate
          • Pow
          • Prepend
          • Query
          • RTrim
          • Radians
          • Range
          • Reduce
          • Ref
          • RegexEscape
          • Remove
          • Repeat
          • Replace
          • ReplaceStr
          • ReplaceStrRegex
          • Reverse
          • Role
          • Roles
          • Round
          • Second
          • Select
          • SelectAll
          • Sign
          • Sin
          • Singleton
          • Sinh
          • Space
          • Sqrt
          • StartsWith
          • SubString
          • Subtract
          • Sum
          • Take
          • Tan
          • Tanh
          • Time
          • TimeAdd
          • TimeDiff
          • TimeSubtract
          • TitleCase
          • ToArray
          • ToDate
          • ToDouble
          • ToInteger
          • ToMicros
          • ToMillis
          • ToNumber
          • ToObject
          • ToSeconds
          • ToString
          • ToTime
          • Tokens
          • Trim
          • Trunc
          • Union
          • Update
          • UpperCase
          • Var
          • Year
    • Drivers
      • Version strategy
      • Imports
      • Connections
      • C#
      • Go
      • JVM (Java, Scala)
      • JavaScript
      • Python
      • Known issues
    • Security
      • Keys
      • Tokens
      • External authentication
        • JSON Web Tokens (JWTs)
        • AccessProvider
        • Auth0 configuration
      • Credentials
      • Attribute-based access control (ABAC)
      • ABAC best practices
        • Role-based authentication
        • Identity-based authentication
      • User-defined roles
      • Permissions
      • Delegates
    • References
      • Glossary
      • Release notes for Fauna products
Fauna current
  • Fauna
    • current
    • v4
    • v3
  • Learn
  • Cookbook
  • FQL
  • Math

Math recipes

This section contains solutions to common math problems that can be solved with FQL:

  • Unsigned integer subtraction

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!

Zip together two arrays Unsigned integer subtraction
Copyright © 2018–2023 Fauna, Inc.
Terms of use Privacy Policy ↑
×

Keyboard shortcuts

While reading

? or h
Shows this help.
/ or Alt+f or ⌘Control+K
Focus the search field.
←
Navigate to the previous page (higher up the TOC).
→
Navigate to the next page (lower down the TOC).
[
Switch to the previous language (to the left, wraps around).
]
Switch to the next language (to the right, wraps around).
t
Scroll to the top of the page.
b
Scroll to the bottom of the page.

While searching

Enter
Navigate to the highlighted search result.
Esc
Deselect the search field and hide the search results.
↑
Highlight the previous search result.
↓
Highlight the next search result.

URL fragments

Use the following URL fragments to scroll to parts of a page:

#/term
Scroll to the first instance of term on the page.
#Pn
Scroll to the nth paragraph on the page.
#Sn
Scroll the nth percentage of the page height.