Thispage provides an overview of all GoogleSQL for BigQuerydata types, including information about their valuedomains. Forinformation on data type literals and constructors, seeLexical Structure and Syntax.
A repeated column is stored as an array, and the size is calculated based on thecolumn data type and the number of values. For example, an integer column(INT64) that is repeated (ARRAY) and contains 4 entries is calculatedas 32 logical bytes (4 entries x 8 logical bytes). The total size of all valuesin a table row can't exceed themaximum row size.
A data type that is declared with parameters is called a parameterized datatype. You can only use parameterized data types with columns and scriptvariables. A column with a parameterized data type is a parameterized columnand a script variable with a parameterized data type is a parameterized scriptvariable. Parameterized type constraints are enforced when writing a value to aparameterized column or when assigning a value to a parameterized scriptvariable.
Notice that the second example contains three expressions: one that returns anINT64, one that returns a FLOAT64, and one thatdeclares a literal. This expression works because all three expressions shareFLOAT64 as a supertype.
You can write an empty array of a specific type using ARRAY[]. You canalso write an untyped empty array using [], in which case GoogleSQLattempts to infer the array type from the surrounding context. IfGoogleSQL cannot infer a type, the default type ARRAY is used.
GENERATE_ARRAYgenerates an array of values from a starting and ending value and a step value.For example, the following query generates an array that contains all of the oddintegers from 11 to 33, inclusive:
String and bytes are separate types that cannot be used interchangeably.Most functions on strings are also defined on bytes. The bytes versionoperates on raw bytes rather than Unicode characters. Casts between string andbytes enforce that the bytes are encoded using UTF-8.
The date type represents a Gregorian calendar date, independent of time zone. Adate value does not represent a specific 24-hour time period. Rather, a givendate value represents a different 24-hour period when interpreted in differenttime zones, and may represent a shorter or longer day during daylight savingtime (DST) transitions.To represent an absolute point in time,use a timestamp.
A datetime value represents a Gregorian date and a time,as they might be displayed on a watch, independent of time zone.It includes the year, month, day, hour, minute, second,and subsecond.To represent an absolute point in time,use a timestamp.
A single location in coordinate space known as a point. A point has an x-coordinate value and a y-coordinate value, where the x-coordinate is longitude and the y-coordinate is latitude of the point on the WGS84 reference ellipsoid.
A polygon, which is represented as a planar surface defined by 1 exterior boundary and 0 or more interior boundaries. Each interior boundary defines a hole in the polygon. The boundary loops of polygons are oriented so that if you traverse the boundary vertices in order, the interior of the polygon is on the left.
The points, linestrings and polygons of a geography value form a simplearrangement on the WGS84 reference ellipsoid.A simple arrangement is one where no point on the WGS84 surface is containedby multiple elements of the collection. If self intersections exist, theyare automatically removed.
The geography that contains no points, linestrings or polygons is called anempty geography. An empty geography is not associated with a particulargeometry shape. For example, the following query produces the same results:
This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
You can construct an INTERVAL object with a STRING that contains thedatetime parts that you want to include, a starting datetime part, and an endingdatetime part. The resulting INTERVAL object only includes datetime parts inthe specified range.
Decimal type values are numeric values with fixed decimal precision and scale.Precision is the number of digits that the number contains. Scale ishow many of these digits appear after the decimal point.
Function calls and operators return an overflow error if the input is finitebut the output would be non-finite. If the input contains non-finite values, theoutput can be non-finite. In general functions do not introduce NaNs or+/-inf. However, specific functions like IEEE_DIVIDE can return non-finitevalues on finite input. All such cases are noted explicitly inMathematical functions.
All functions and operators that act on string values operate on Unicodecharacters rather than bytes. For example, functions like SUBSTR and LENGTHapplied to string input count the number of characters, not bytes.
Each Unicode character has a numeric value called a code point assigned to it.Lower code points are assigned to lower characters. When characters arecompared, the code points determine which characters are less than or greaterthan other characters.
Most functions on strings are also defined on bytes. The bytes versionoperates on raw bytes rather than Unicode characters. Strings and bytes areseparate types that cannot be used interchangeably. There is no implicit castingin either direction. Explicit casting between string and bytes doesUTF-8 encoding and decoding. Casting bytes to string returns an error if thebytes are not valid UTF-8.
The output type is an anonymous struct type with anonymous fields with typesmatching the types of the input expressions. There must be at least twoexpressions specified. Otherwise this syntax is indistinguishable from anexpression wrapped with parentheses.
Typed syntax allows constructing structs with an explicit struct data type. Theoutput type is exactly the field_type provided. The input expression iscoerced to field_type if the two types are not the same, and an error isproduced if the types are not compatible. AS alias is not allowed on the inputexpressions. The number of expressions must match the number of fields in thetype, and the expression types must be coercible or literal-coercible to thefield types.
Notice, though, that these direct equality comparisons compare the fields ofthe struct pairwise in ordinal order ignoring any field names. If instead youwant to compare identically named fields of a struct, you can compare theindividual fields directly.
A time zone is used when converting from a civil date or time (as might appearon a calendar or clock) to a timestamp (an absolute time), or vice versa. Thisincludes the operation of parsing a string containing a civil date and time like"2020-01-01 00:00:00" and converting it to a timestamp. The resulting timestampvalue itself does not store a specific time zone, because it represents oneinstant in time globally.
Note that not all time zone names are interchangeable even if they do happen toreport the same time during a given part of the year. For example,America/Los_Angeles reports the same time as UTC-7:00 during daylightsaving time (DST), but reports the same time as UTC-8:00 outside of DST.
If the input contains values that use ":60" in the seconds field to represent aleap second, that leap second is not preserved when converting to a timestampvalue. Instead that value is interpreted as a timestamp with ":00" in theseconds field of the following minute.
Leap seconds do not affect timestamp computations. All timestamp computationsare done using Unix-style timestamps, which do not reflect leap seconds. Leapseconds are only observable through functions that measure real-world time. Inthese functions, it is possible for a timestamp second to be skipped or repeatedwhen there is a leap second.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Each data type has an external representation determined by its input and output functions. Many of the built-in types have obvious external formats. However, several types are either unique to PostgreSQL, such as geometric paths, or have several possible formats, such as the date and time types. Some of the input and output functions are not invertible, i.e., the result of an output function might lose accuracy when compared to the original input.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.
Attribute names must be at least one character long and less than 64 KB in size. It is considered best practice to keep your attribute names as short as possible. This helps reduce read request units consumed, as attribute names are included in metering of storage and throughput usage.
Although DynamoDB allows you to use these reserved words and special characters for names, we recommend that you avoid doing so because you have to define placeholder variables whenever you use these names in an expression. For more information, see Expression attribute names in DynamoDB.
When you create a table or a secondary index, you must specify the names and data types of each primary key attribute (partition key and sort key). Furthermore, each primary key attribute must be defined as type string, number, or binary.
DynamoDB is a NoSQL database and is schemaless. This means that other than the primary key attributes, you don't have to define any attributes or data types when you create tables. By comparison, relational databases require you to define the names and data types of each column when you create a table.
3a8082e126