1CREATE DATABASE `mydb`;
2
3CREATE TABLE `my_table`
4(
5 my_table_id INT AUTO_INCREMENT,
6 my_table_name VARCHAR(30) NOT NULL,
7 my_foreign_key INT NOT NULL,
8 my_tb_created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
9 my_tb_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ,
10 # Any other properties here
11 PRIMARY KEY(my_table_id),
12 CONSTRAINT fk_name_of_parent_table
13 FOREIGN KEY(my_foreign_key) REFERENCES parent_table(parent_table_column)
14);
15
16SHOW DATABASES;
1CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name
2 [create_option] ...
3
4create_option: {
5 [DEFAULT] CHARACTER SET [=] charset_name
6 | [DEFAULT] COLLATE [=] collation_name
7}