mariadbWorking with JSON in Mariadb
JSON is a popular data format for storing and exchanging data. MariaDB supports JSON data types, allowing you to store and manipulate JSON documents in MariaDB.
Example code
CREATE TABLE json_table (
id INT NOT NULL AUTO_INCREMENT,
json_data JSON,
PRIMARY KEY (id)
);
Output example
Query OK, 0 rows affected (0.02 sec)
Code explanation
CREATE TABLE
: This statement creates a new table in the database.json_table
: This is the name of the table being created.id INT NOT NULL AUTO_INCREMENT
: This creates a column calledid
with an integer data type that is not null and automatically increments.json_data JSON
: This creates a column calledjson_data
with a JSON data type.PRIMARY KEY (id)
: This sets theid
column as the primary key for the table.
Helpful links
More of Mariadb
- What type to use for a year in Mariadb?
- How to use XA transactions in Mariadb?
- How to work with XML in Mariadb?
- How to check version of Mariadb?
- How to install Mariadb on Ubuntu?
- How to list users in Mariadb?
- How to use UUID in Mariadb?
- How to get current year in Mariadb?
- How to use xtrabackup in Mariadb?
- How to change wait_timeout in Mariadb?
See more codes...