🔏
Tech
  • 🟢App aspects
    • Software architecture
      • Caching
      • Anti-patterns
      • System X-ability
      • Coupling
      • Event driven architecture
        • Command Query Responsibility Segregation (CQRS)
        • Change Data Capture (CDC)
      • Distributed transactions
      • App dev notes
        • Architecture MVP
      • TEMP. Check list
      • Hexagonal arch
      • Communication
        • REST vs messaging
        • gRPC
        • WebSocket
      • Load balancers
      • Storage limits
      • Event storming
    • Authentication
    • Deployment strategy
  • Databases
    • Classification
    • DB migration tools
    • PostreSQL
    • Decision guidance
    • Index
      • Hash indexes
      • SSTable, LSM-Trees
      • B-Tree
      • Engines, internals
    • Performance
  • System design
    • Interview preparation
      • Plan
        • Instagram
        • Tinder
        • Digital wallet
        • Dropbox
        • Live video streaming
        • Uber
        • Whatsup
        • Tiktok
        • Twitter
        • Proximity service
    • Algorithms
    • Acronyms
  • 🟢Programming languages
    • Java
      • Features
        • Field hiding
        • HashCode() and Equals()
        • Reference types
        • Pass by value
        • Atomic variables
      • Types
      • IO / NIO
        • Java NIO
          • Buffer
          • Channel
        • Java IO: Streams
          • Input streams
            • BufferedInputStream
            • DataInputStream
            • ObjectInputStream
            • FilterInputStream
            • ByteArrayInputStream
        • Java IO: Pipes
        • Java IO: Byte & Char Arrays
        • Java IO: Input Parsing
          • PushbackReader
          • StreamTokenizer
          • LineNumberReader
          • PushbackInputStream
        • System.in, System.out, System.error
        • Java IO: Files
          • FileReader
          • FileWriter
          • FileOutputStream
          • FileInputStream
      • Multithreading
        • Thread liveness
        • False sharing
        • Actor model
        • Singleton
        • Future, CompletableFuture
        • Semaphore
      • Coursera: parallel programming
      • Coursera: concurrent programming
      • Serialization
      • JVM internals
      • Features track
        • Java 8
      • Distributed programming
      • Network
      • Patterns
        • Command
      • Garbage Collectors
        • GC Types
        • How GC works
        • Tools for GC
    • Kotlin
      • Scope functions
      • Inline value classes
      • Coroutines
      • Effective Kotlin
    • Javascript
      • Javascript vs Java
      • TypeScript
    • SQL
      • select for update
    • Python
  • OS components
    • Network
      • TCP/IP model
        • IP address in action
      • OSI model
  • 🟢Specifications
    • JAX-RS
    • REST
      • Multi part
  • 🟢Protocols
    • HTTP
    • OAuth 2.0
    • LDAP
    • SAML
  • 🟢Testing
    • Selenium anatomy
    • Testcafe
  • 🟢Tools
    • JDBC
      • Connection pool
    • Gradle
    • vim
    • git
    • IntelliJ Idea
    • Elastic search
    • Docker
    • Terraform
    • CDK
    • Argo CD
      • app-of-app setup
    • OpenTelemetry
    • Prometheus
    • Kafka
      • Consumer lag
  • 🟢CI
    • CircleCi
  • 🟢Platforms
    • AWS
      • VPC
      • EC2
      • RDS
      • S3
      • IAM
      • CloudWatch
      • CloudTrail
      • ELB
      • SNS
      • Route 53
      • CloudFront
      • Athena
      • EKS
    • Kubernetes
      • Networking
      • RBAC
      • Architecture
      • Pod
        • Resources
      • How to try
      • Kubectl
      • Service
      • Tooling
        • ArgoCD
        • Helm
        • Istio
    • GraalVM
    • Node.js
    • Camunda
      • Service tasks
      • Transactions
      • Performance
      • How it executes
  • 🟢Frameworks
    • Hibernate
      • JPA vs Spring Data
    • Micronaut
    • Spring
      • Security
      • JDBC, JPA, Hibernate
      • Transactions
      • Servlet containers, clients
  • 🟢Awesome
    • Нейробиология
    • Backend
      • System design
    • DevOps
    • Data
    • AI
    • Frontend
    • Mobile
    • Testing
    • Mac
    • Books & courses
      • Path: Java Concurrency
    • Algorithms
      • Competitive programming
    • Processes
    • Finance
    • Electronics
  • 🟢Electronics
    • Arduino
    • IoT
  • Artificial intelligence
    • Artificial Intelligence (AI)
  • 🚀Performance
    • BE
  • 📘Computer science
    • Data structures
      • Array
      • String
      • LinkedList
      • Tree
    • Algorithms
      • HowTo algorithms for interview
  • 🕸️Web dev (Frontend)
    • Trends
    • Web (to change)
  • 📈Data science
    • Time series
Powered by GitBook
On this page
  • SQL joins
  • MySQL data types
  • Character Data
  • Text data
  • Numeric data
  • Temporal data
  • Index
  • B-Tree (Balanced tree)

Was this helpful?

  1. Programming languages

SQL

PreviousTypeScriptNextselect for update

Last updated 1 year ago

Was this helpful?

SQL joins

MySQL data types

Character Data

  • char(20)

    • fixed length

    • 255 bytes max

    • string in the column have the same length

  • varchar(20)

    • variable length

    • 64 KB max

    • strings may have diff length in the column

Character sets

  • SHOW CHARACTER SET;

  • some character sets may be multibyte (several bytes to store one character)

Text data

text type

max byte size

tinytext

255

text

65KB

mediumtext

16MB

longtext

4GB

if data longer than column size => data is truncated

Numeric data

Type

Signed range

Unsigned range

tinyint

−128 to 127

0 to 255

smallint

−32,768 to 32,767

0 to 65,535

mediumint

−8,388,608 to 8,388,607

0 to 16,777,215

int

−2,147,483,648 to 2,147,483,647

0 to 4,294,967,295

bigint

−2^63 to 2^63 - 1

0 to 2^64 - 1

Type

Numeric range

float( p , s )

−3.402823466E+38 to −1.175494351E-38

and 1.175494351E-38 to 3.402823466E+38

double( p , s )

−1.7976931348623157E+308 to −2.2250738585072014E-308

and 2.2250738585072014E-308 to 1.7976931348623157E+308

Temporal data

Type

Default format

Allowable values

date

YYYY-MM-DD

1000-01-01 to 9999-12-31

datetime

YYYY-MM-DD HH:MI:SS

1000-01-01 00:00:00.000000

to 9999-12-31 23:59:59.999999

timestamp

YYYY-MM-DD HH:MI:SS

1970-01-01 00:00:00.000000

to 2038-01-18 22:14:07.999999

year

YYYY

1901 to 2155

time

HHH:MI:SS

−838:59:59.000000

to 838:59:59.000000

Index

B-Tree (Balanced tree)

If the query has a function e.g. where YEAR(...)=2013; index does not help at all.

🟢
⚠️