data

CREATE DATABASE db_exp
WITH OWNER = dbadmin
ENCODING = ‘UTF8’
TEMPLATE = template0
LC_COLLATE = ‘en_US.UTF-8’
LC_CTYPE = ‘en_US.UTF-8’
CONNECTION LIMIT = -1
COMPATIBLE = ‘MYSQL’;

\c db_exp;

CREATE USER user_exp WITH PASSWORD ‘Gauss…


This content originally appeared on DEV Community and was authored by Özcan Kara

CREATE DATABASE db_exp
WITH OWNER = dbadmin
ENCODING = 'UTF8'
TEMPLATE = template0
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
CONNECTION LIMIT = -1
COMPATIBLE = 'MYSQL';

\c db_exp;

CREATE USER user_exp WITH PASSWORD 'GaussDB@2023';

GRANT sysadmin TO user_exp;

CREATE SCHEMA sche_exp AUTHORIZATION user_exp;

Task 2: Create a Row-Store and Column-Store Table (10 Points)

SET search_path TO sche_exp;

CREATE TABLE tab_row (
    id INT,
    stu_id INT,
    grade VARCHAR(20)
)
DISTRIBUTE BY HASH(id);

INSERT INTO tab_row (id, stu_id, grade) VALUES
(1, 1, 'first'),
(2, 2, 'second'),
(3, 3, 'third'),
(4, 4, 'fourth');

CREATE TABLE tab_column (
    id INT,
    name VARCHAR(30),
    score INT
)
DISTRIBUTE BY HASH(id)
COMPRESS LEVEL MIDDLE;

INSERT INTO tab_column (id, name, score) VALUES
(1, 'zhangsan', 80),
(2, 'lisi', 85),
(3, 'wangwu', 90);

CREATE INDEX idx_column ON tab_column (name, score);

CREATE VIEW view_tab AS
SELECT name, score
FROM tab_column
WHERE score > 80;


This content originally appeared on DEV Community and was authored by Özcan Kara


Print Share Comment Cite Upload Translate Updates
APA

Özcan Kara | Sciencx (2024-09-27T08:08:56+00:00) data. Retrieved from https://www.scien.cx/2024/09/27/data/

MLA
" » data." Özcan Kara | Sciencx - Friday September 27, 2024, https://www.scien.cx/2024/09/27/data/
HARVARD
Özcan Kara | Sciencx Friday September 27, 2024 » data., viewed ,<https://www.scien.cx/2024/09/27/data/>
VANCOUVER
Özcan Kara | Sciencx - » data. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/27/data/
CHICAGO
" » data." Özcan Kara | Sciencx - Accessed . https://www.scien.cx/2024/09/27/data/
IEEE
" » data." Özcan Kara | Sciencx [Online]. Available: https://www.scien.cx/2024/09/27/data/. [Accessed: ]
rf:citation
» data | Özcan Kara | Sciencx | https://www.scien.cx/2024/09/27/data/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.