
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What is the Java equivalent to MySQL's smallint?
The short is equivalent to MySQL’s small int. The Java short takes 2 bytes that has the range -32768 to 32767 while MySQL smallint also take 2 bytes with same range.
Here is the demo code of short in Java −
public class SmallIntAsShortDemo { public static void main(String[] args) { short value = 32767; System.out.println(value); value = -32768; System.out.println(value); // value = 32768; // System.out.println(value); } }
The snapshot is as follows −
This will produce the following output −
32767 -32768
Here is the snapshot of the output we ran in EclipseIDE −
The MySQL smallint takes 2 bytes with same range.
- Related Articles
- What is the C# equivalent to Java's isInstance()?
- What is the PHP equivalent of MySQL's UNHEX()?
- What's the Kotlin equivalent of Java's String[]?
- What is the Maximum Value of smallint(6) unsigned in MySQL?
- C# equivalent to Java's Thread.setDaemon?
- What is the MySQL SELECT INTO Equivalent?
- What is the equivalent of Java long in the context of MySQL variables?
- What is the equivalent of EXCEPT in MySQL?
- What is the PHP stripos() equivalent in MySQL?
- C# Equivalent to Java's Double Brace Initialization?
- Kotlin equivalent of Java's equalsIgnoreCase
- What is the equivalent of C# namespace in Java?
- What is the C# equivalent for the Java System.exit(0)?
- What is the equivalent of Java static methods in Kotlin?
- Does SQL Server have an equivalent to MySQL's ENUM data type?

Advertisements