Last active
September 16, 2018 14:34
-
-
Save handuy/e88b2284c4480a60e8464e6ac0417f76 to your computer and use it in GitHub Desktop.
Cú pháp chạy: psql -U postgres -f [tên_file]. Chạy file 2.sql ở citus_master, 2_test.sql ở citus_worker_1
This file contains 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
DROP TABLE IF EXISTS users; | |
DROP TABLE IF EXISTS posts; | |
DROP SCHEMA IF EXISTS course CASCADE; | |
CREATE SCHEMA course; | |
CREATE TABLE users (id int, name text, age int); | |
CREATE TABLE posts (id int, title text); | |
CREATE TABLE course.lessons (id int, title text, point int); | |
SELECT create_reference_table('users'); | |
SELECT create_reference_table('posts'); | |
SELECT create_reference_table('course.lessons'); | |
INSERT INTO users VALUES (1, 'Duy', 26), (2, 'Long', 24), (3, 'Huy', 28); | |
INSERT INTO posts VALUES (1, 'Hello World'), (2, 'Hello Citus'), (3, 'Hello Vietnam'); | |
INSERT INTO course.lessons VALUES (1, 'Java', 10), (2, 'HTML', 20), (3, 'CSS', 40); | |
UPDATE users SET name = 'Cuong' WHERE id = 3; | |
DELETE FROM posts WHERE id = 3; | |
UPDATE course.lessons SET title = 'Javascript' WHERE id = 1; | |
SELECT * FROM users; | |
SELECT * FROM posts; | |
SELECT * FROM course.lessons; |
This file contains 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
\d | |
SELECT * FROM posts_102011; | |
SELECT * FROM users_102010; | |
select * from course.lessons_102021; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment