Snippets

Catalyst2 Create test MyISAM database

Updated by Robert

File create-test-myisam-database Modified

  • Ignore whitespace
  • Hide word diff
 -- you probably want to use InnoDB instead.
 
 -- Create a database named test
-CREATE DATABASE test
+CREATE DATABASE testdb
 CHARACTER SET utf8mb4
 COLLATE utf8mb4_unicode_ci;
 
 -- Switch to the new database
-USE test;
+USE testdb;
 
 -- Create a table for suppliers
 CREATE TABLE suppliers (
Created by Robert

File create-test-myisam-database Added

  • Ignore whitespace
  • Hide word diff
+-- 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 test
+CREATE DATABASE test
+CHARACTER SET utf8mb4
+COLLATE utf8mb4_unicode_ci;
+
+-- Switch to the new database
+USE test;
+
+-- Create a table for suppliers
+CREATE TABLE suppliers (
+  id INT NOT NULL AUTO_INCREMENT,
+  name VARCHAR(60) NOT NULL,
+  PRIMARY KEY(id)
+) ENGINE=MyISAM;
+
+-- Create a table for products
+CREATE TABLE products (
+  id INT NOT NULL AUTO_INCREMENT,
+  supplier INT NOT NULL,
+  name VARCHAR(60) NOT NULL,
+  PRIMARY KEY(id)
+) ENGINE=MyISAM;
+
+-- Insert some suppliers
+INSERT INTO suppliers (name) VALUES 
+('Wonka Industries'),
+('Acme Corp.');
+
+-- Insert some products
+INSERT INTO products (supplier, name) VALUES 
+(1, 'Wonkies'),
+(2, 'Honkies'),
+(1, 'Conkies');
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.