1sudo -u postgres psql
2postgres=# create database mydb;
3postgres=# create user myuser with encrypted password 'mypass';
4postgres=# grant all privileges on database mydb to myuser;
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;