-- The below commands create a basic MySQL/MariaDB database with two tables.-- Both tables use the MyISAM storage engine. That's not a recommendation;-- you probably want to use InnoDB instead.-- Create a database named testCREATEDATABASEtestdbCHARACTERSETutf8mb4COLLATEutf8mb4_unicode_ci;-- Switch to the new databaseUSEtestdb;-- Create a table for suppliersCREATETABLEsuppliers(idINTNOTNULLAUTO_INCREMENT,nameVARCHAR(60)NOTNULL,PRIMARYKEY(id))ENGINE=MyISAM;-- Create a table for productsCREATETABLEproducts(idINTNOTNULLAUTO_INCREMENT,supplierINTNOTNULL,nameVARCHAR(60)NOTNULL,PRIMARYKEY(id))ENGINE=MyISAM;-- Insert some suppliersINSERTINTOsuppliers(name)VALUES('Wonka Industries'),('Acme Corp.');-- Insert some productsINSERTINTOproducts(supplier,name)VALUES(1,'Wonkies'),(2,'Honkies'),(1,'Conkies');
Used to illustrate my Advantages of InnoDB over MyISAM article.