totn MariaDB

MariaDB Tutorial

MariaDB is an open-source relational database technology. It is a great alternative or drop-in replacement for MySQL.

Our tutorial will start with the basics of MariaDB such as how to retrieve and manipulate data. Then we will move to the more advanced topics such as how to create tables, functions, procedures, and triggers. We will conclude with a review of the functions that are proprietary to MariaDB.

With this tutorial, you should be on your way to becoming proficient in MariaDB and its programming language.

Prerequisites

There are no prequisities for this MariaDB tutorial. You should be able to easily understand this tutorial and learn the basic concepts of MariaDB as you progress to the more advanced topics.

Now, let's get started!

Start Tutorial

Or jump directly to a topic in MariaDB:

MariaDB Functions

Functions - Alphabetical MariaDB Functions listed alphabetically
Functions - Category MariaDB Functions listed by category

MariaDB Keys, Constraints and Indexes

Primary Keys Create, alter, and drop primary keys
Unique Constraints Create, add, and drop unique constraints
Indexes Create, drop and rename indexes (performance tuning)

MariaDB Privileges and Passwords

Grant/Revoke Privileges Grant or revoke privileges
Change Password Change a user's password

MariaDB Database Administration

Users Database accounts

MariaDB Programming

Functions Create and drop functions
Procedures Create and drop procedures
Cursors Create cursors within stored programs
Literals (Constants) String, number, date, time, boolean literals
Declaring Variables Declare variables within stored programs
Loops and Conditional Statements LOOP statement, IF-THEN-ELSE and others
AUTO_INCREMENT (Sequences) Create a sequence of numbers using the AUTO_INCREMENT attribute
Comments within SQL How to create comments within your SQL statement

MariaDB Comparison Operators

Comparison Operators Operators such as =, <>, !=, >, <, and so on

MariaDB Query Types

SELECT Statement Retrieve records from one or more tables
SELECT LIMIT Statement Retrieve records from a table and limit results
INSERT Statement Insert records into a table
UPDATE Statement Update existing records in a table
DELETE Statement Delete records from a table
DELETE LIMIT Statement Delete records and limit number of deletions
TRUNCATE TABLE Statement Delete all records from a table (no rollback)
UNION Operator Combine 2 result sets (removes duplicates)
UNION ALL Operator Combine 2 result sets (includes duplicates)
INTERSECT Operator Intersection of 2 result sets
Subqueries A query within a query

MariaDB Joins

JOIN Tables Inner and Outer joins

MariaDB Aliases

ALIASES Create a temporary name for a column or table

MariaDB Clauses

DISTINCT Clause Remove duplicates from the results
FROM Clause List tables and join information
WHERE Clause Filter results
ORDER BY Clause Sort query results
GROUP BY Clause Group by one or more columns
HAVING Clause Restrict the groups of returned rows

MariaDB SQL Functions

COUNT Function Return the count of an expression
SUM Function Return the sum of an expression
MIN Function Return the min of an expression
MAX Function Return the max of an expression
AVG Function Return the average of an expression

MariaDB Conditions

AND Condition 2 or more conditions to be met
OR Condition Any one of the conditions are met
AND and OR Combine AND and OR conditions
LIKE Condition Use simple pattern matching (wildcards) in a WHERE clause
RLIKE Condition Use regular expression matching in a WHERE clause
IN Condition Alternative to multiple OR conditions
NOT Condition Negate a condition
IS NULL Condition Test for a NULL value
IS NOT NULL Condition Test for a NOT NULL value
BETWEEN Condition Retrieve within a range (inclusive)
EXISTS Condition Condition is met if subquery returns at least one row

MariaDB Tables and Views

CREATE TABLE Create a table
CREATE TABLE AS Create a table from another table's definition and data
ALTER TABLE Add, modify, delete columns in a table; rename a table
DROP TABLE Delete a table
VIEW Virtual tables (views of other tables)

MariaDB Data Types

Data Types Data Types in MariaDB

MariaDB Question and Answer

Question & Answer Various questions and answers