This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table array_fn (test_array text[]); | |
insert into array_fn values ('{This,Is,What,Bothers,Me}'); | |
select test_array[3]::varchar from array_fn; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select name, | |
unnest(schedule), | |
unnest(pay_by_quarter) | |
from sal_emp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create type order_status as enum ( | |
'placed', | |
'accepted', | |
'cancelled_by_customer', | |
'cancelled_by_restaurant', | |
'delivered' | |
); | |
drop table if exists orders; | |
create table orders ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run on Master | |
# Replace slave-ip and master-ip with actual ip addresses of those machines | |
CREATE USER repl; | |
GRANT REPLICATION SLAVE ON *.* TO repl_user@'slave-ip' IDENTIFIED BY 'passwd'; | |
# Run on Slave | |
CHANGE MASTER TO MASTER_HOST = 'master-ip', MASTER_PORT = 3306, MASTER_USER = 'repl', MASTER_PASSWORD = 'passwd'; | |
START SLAVE; | |
# To check the Status of Replication |
OlderNewer