data type
The kind of a value, such as a whole number, text or a date, which decides what you can do with it and how it compares and sorts.
In more detail
Operations depend on types: in many languages + adds two numbers but joins two strings. In a database, each column has a type that limits which values it may hold. Choosing the right type catches mistakes early and makes values compare and sort correctly.
Example
type(3.0)Related terms
- dynamic typing — A language design where a variable can hold a value of any type and types are only checked while the program runs.
- type conversion — Turning a value of one type into another, such as the string "23" into the integer 23.
- class — A blueprint in code that bundles data and the functions that work on it, from which objects are made.
- TypeError — The exception raised when an operation or function gets a value of the wrong type, such as adding a number to a string.
- INTEGER — The column type for whole numbers, used in this course for keys, quantities and money stored in cents.
- storage class — In SQLite, the actual kind of a stored value: NULL, INTEGER, REAL, TEXT or BLOB.
- type affinity — SQLite's rule that a column's declared type is only a preference: values are converted when sensible and otherwise stored as they are.
- STRICT table — A SQLite table declared with the STRICT keyword, which rejects any value that does not match its column's declared type.
- DATE — A PostgreSQL column type that holds a calendar date, validates it, sorts it and supports date arithmetic.
Taught in
- Types And Functions, A Whirlwind Tour — Hands-on Python: Complete Video Course & Book
- Strings, Delimiters And Concatenation — Hands-on Python: Complete Video Course & Book
- Lists, Range And The For Loop — Hands-on Python: Complete Video Course & Book
- Data Types And What To Choose — PostgreSQL, Indexing & Relational Data Modeling