Referensi
- PostgREST, http://postgrest.org/
The world's most advanced open source database
#!/bin/bash ##copy_schema.sh dbusername="$1" dbname="$2" from_schema="$3" to_schema="$4" pg_dump -U "$from_schema" -h localhost -W --schema="$from_schema" "$dbname" | sed "s/$from_schema/$to_schema/g" > "$to_schema".sql echo "\i "$to_schema".sql" | psql -v ON_ERROR_STOP=1 -U "$to_schema" -d "$dbname" -h localhost -W
#!/bin/bash ##copy_schema.sh dbusername="$1" dbname="$2" from_schema="$3" to_schema="$4" pg_dump -U "$from_schema" -h localhost -W --schema-only --schema="$from_schema" "$dbname" | sed "s/$from_schema/$to_schema/g" > "$to_schema".sql echo "\i "$to_schema".sql" | psql -v ON_ERROR_STOP=1 -U "$to_schema" -d "$dbname" -h localhost -W
WITH par AS (
SELECT ROW_NUMBER() OVER (PARTITION BY id_paragraph) AS rn, id_paragraph
FROM paragraph_soal WHERE id_paragraph='2013 (A.11)20-22'
)
SELECT * from par where rn = 1;