This content originally appeared on DEV Community and was authored by Özcan Kara
CREATE USER hccdp WITH SYSADMIN PASSWORD 'sadece1234';
CREATE DATABASE hccdp_db OWNER hccdp TEMPLATE template0 ENCODING 'UTF8';
gsql -d hccdp_db -U hccdp -p 5432
CREATE SCHEMA hccdp;
\i /root/create_table.sql
SELECT u.usename, n.nspname, d.datname, t.tablename
FROM pg_user u, pg_namespace n, pg_database d, pg_tables t
WHERE u.usename='hccdp' AND n.nspname='hccdp' AND d.datname='hccdp_db' AND t.schemaname='hccdp';
wget https://labfiles-singapore.obs.ap-southeast-3.myhuaweicloud.com/data.zip
unzip lab_data.zip
\copy nation FROM 'nation.csv' DELIMITER ',' CSV;
\copy part FROM 'part.csv' DELIMITER ',' CSV;
\copy supplier FROM 'supplier.csv' DELIMITER ',' CSV;
\copy partsupp FROM 'partsupp.csv' DELIMITER ',' CSV;
\copy orders FROM 'orders.csv' DELIMITER ',' CSV;
\copy lineitem FROM 'lineitem.csv' DELIMITER ',' CSV;
SELECT SUM(countnum) FROM (
SELECT COUNT(*) AS countnum FROM nation
UNION ALL
SELECT COUNT(*) AS countnum FROM part
UNION ALL
SELECT COUNT(*) AS countnum FROM supplier
UNION ALL
SELECT COUNT(*) AS countnum FROM partsupp
UNION ALL
SELECT COUNT(*) AS countnum FROM orders
UNION ALL
SELECT COUNT(*) AS countnum FROM lineitem
) AS total_counts;
This content originally appeared on DEV Community and was authored by Özcan Kara
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
Özcan Kara | Sciencx (2024-06-28T09:14:46+00:00) abcd. Retrieved from https://www.scien.cx/2024/06/28/abcd/
" » abcd." Özcan Kara | Sciencx - Friday June 28, 2024, https://www.scien.cx/2024/06/28/abcd/
HARVARDÖzcan Kara | Sciencx Friday June 28, 2024 » abcd., viewed ,<https://www.scien.cx/2024/06/28/abcd/>
VANCOUVERÖzcan Kara | Sciencx - » abcd. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/28/abcd/
CHICAGO" » abcd." Özcan Kara | Sciencx - Accessed . https://www.scien.cx/2024/06/28/abcd/
IEEE" » abcd." Özcan Kara | Sciencx [Online]. Available: https://www.scien.cx/2024/06/28/abcd/. [Accessed: ]
rf:citation » abcd | Özcan Kara | Sciencx | https://www.scien.cx/2024/06/28/abcd/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.