Google News
logo
MariaDB - Interview Questions
How to create a table in MariaDB's database?
First, you have to create a database in MariaDB follows by selecting the database and then create a table by using the CREATE TABLE statement. You must have the CREATE privilege for a table or on the database to create a table.
 
Create table statement creates a table name followed by a list of columns, indexes, and constraints. By default, a table is created in the default database
 
Syntax :
CREATE TABLE table_name (column_name column_type);     
For example :
CREATE TABLE Students(    
student_id INT NOT NULL AUTO_INCREMENT,    
student_name VARCHAR(100) NOT NULL,    
student_address VARCHAR(40) NOT NULL,    
admission_date DATE,    
PRIMARY KEY ( student_id ));
Output :
Query OK, 0 rows affected (0.312 sec)

You can verify that whether the table is created by using SHOW TABLES command.
SHOW TABLES;
Advertisement