MariaDB Table Basic
Login to MariaDB, select the database where you want to create table then follow below instructions
Objectives
-
MariaDB Table Create
-
MariaDB Table Drop
MariaDB Table Create
Assume that the database name is mariadb_tutorial. Let’s create a table called person. First select database using USE mariadb_tutorial
then run the below commands. If you want, then can see details version of table creation.
CREATE TABLE IF NOT EXISTS person (
id int(12) NOT NULL AUTO_INCREMENT,
first_name varchar(150) NOT NULL,
last_name varchar(150),
email varchar(100),
age int,
income double,
PRIMARY KEY (id)
)
MariaDB Table Drop
Syntax
DROP TABLE <table_name>;
--- OR
DROP TABLE IF EXISTS <table_name>;
Example
DROP TABLE person;
--- OR
DROP TABLE IF EXISTS person;