How to Create & Manipulate Data in MariaDB?
Last Updated :
01 Dec, 2023
Data Creation and manipulation are essential for businesses and organizations in today's data-driven environment. The well-liked open-source relational database management system MariaDB provides a strong foundation for managing data. It's critical to grasp how to create and modify data in MariaDB. In this article, we will go through the creation and manipulation of data in MariaDB.
Creating a Database
To create a database in MariaDB we are following these steps:
Step 1: Open MariaDB click on new create a session with the name MariaDB and then enter the password and port.

Step 2: To create a database, right-click on the session name, select Create New, then Database. Enter 'mydb' as the database's name and click OK.

Step 3: Using SQL command
Click on the query button and write this query to insert a data and click on execute button on toolbar.
CREATE DATABASE mydb;
Step 4: Create Table
Create a table by performing a right-click on your mydb database and selecting Create New -> Table. As we are providing books, name our table.

Using SQL command
CREATE TABLE books ( id_book INT, title VARCHAR(50), year DATE );
Step 5: Create Fields
Select the desired fields by clicking on Add. Assume for the moment that we are adding a first field which is book id with the data type int, write length of 5. Add new fields, such as title, and year of the data type varchar and date. Lastly, select Save.
Our table has three columns into which we will add records, but before a record can be added, it must have at least one primary key. ID is going to be our primary key. Right Click on id_book ->create new index -> PRIMARY. Increase the default value's auto-increment. Save.

Using SQL command:
CREATE TABLE books ( id_book INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(50), year DATE );
Data Manipulation
To add records, click on data -> plus icon then double click on title filed and add value and same add date also. Add more records. The SQL statements below are also visible on the console.

Using SQL command:
INSERT INTO books(title, year) VALUES (' A History of Earth', ' 2018-03-02');
Let’s see CRUD operations in MariaDB using SQL commands for manipulating data.
Query - 1: Insert Data
INSERT INTO books (title, year) VALUES ('Computer Networks', ' 2011-03-02');
Output:

Now you can see on data tab that this record get inserted in the books table.
Query - 2: See All Records
SELECT * FROM books;
Output:

Query - 3: Update Record
UPDATE books SET title = 'OS' WHERE YEAR = '2018-03-02';
Output:

Query - 4: Delete Record
DELETE FROM books WHERE title = 'physics';
Output:

Query - 5: Sort Record
select title, year from books order by title;
Output:

Query - 6: Retrieve data between specific year
SELECT * FROM books WHERE year BETWEEN '2018-03-02' AND '2022-11-02';
Output:

Conclusion
Users may create databases, define tables, input data, and manipulate it as necessary with confidence while using MariaDB with the help of this article. Your data management abilities will improve over time as a result of continued practice and investigation of MariaDB's features, enabling you to utilize this robust database system to its fullest.
Similar Reads
MariaDB Create Database
MariaDB is a strong and adaptable relational database management system that retains a wide range of features, including efficient data manipulation. An essential element of database management is the creation of databases, which form the foundation for data organization and storage. In this article
3 min read
How to Change Default MySQL/MariaDB Port in Linux?
The default port that the MySQL database server runs under Linux is 3306/TCP. Use the commands below to change the default MySQL/MariaDB Database port in Linux. vi /etc/mysql/mariadb.conf.d/50-server.cnf Search for the line MYSQL, find port under this line, and replace port values accordingly. [mysq
1 min read
How to create table in Ruby on Rails?
In Ruby on Rails, creating tables involves using migrations, which are a powerful mechanism for managing database schema changes. Here's a detailed breakdown of the process: 1. Database Setup (Optional): While APIs can function without databases, many Rails applications use them for data persistence
3 min read
Create Table in MariaDB
MariaDB is an open-source RDBMS that has become famous for its speed, and scalability. MariaDB Stores data in tables with structured relationships between them. In terms of working with databases, one crucial element involves the construction of tables for organizing and storing data effectively. In
4 min read
How to Insert if Not Exists in MariaDB
When managing a database, the need often arises to either insert a new record or update an existing one. MariaDB provides a powerful tool to handle this situation efficiently: the SQL IF NOT EXISTS clause. This clause allows us to perform an INSERT operation only if the record does not already exist
5 min read
How to Create Database and Collection in MongoDB
MongoDB is a widely used NoSQL database renowned for its flexibility, scalability, and performance in managing large volumes of unstructured data. Whether youâre building a small application or handling big data, MongoDB offers an easy-to-use structure for managing your data. In this article, we wil
6 min read
MariaDB Alter Database
MariaDB is an open-source relational database management system. In comparison to MySQL, MariaDB possesses several similar features, including ACID compliance, support for a wide range of storage engines, and availability of different data types. As our data needs develop, the demand to modify our d
5 min read
How to create SQL table using DBI library in R
DBI library in R programming is used for interacting with different types of database systems such as MySQL for different types of professional work like data analysis using R language. We can easily connect to the database, run queries and retrieve results from the database in the R environment wit
3 min read
Creating an index in MariaDB
MariaDB is an open-source and database managemeÂnt system. MariaDB is used for several purposes like as data warehousing, e-commerce, and logging applications. MariaDB is faster than MySQL in the replication and querying process. MariaDB supports invisible columns and temporary table space. In this
6 min read
How to Create One Table From Another Table in SQL
Creating a table based on the structure and data of an existing table is a common task in database management. This process allows us to replicate a table for backup, testing or data transformation purposes. SQL provides efficient methods to create one table from another while preserving the schema,
3 min read