- 作业标题:Database - final exam
- 课程名称:New York University Database
- 完成周期:1天
Data Import for Final Exam
PostgreSQL
Data sourced from: https://postgrespro.com/education/demodb
download the medium version of data: https://edu.postgrespro.com/demo-medium-en.zip
extract / unzip the compressed file
create or find the name of any existing database (the script will create its own new
database, you just need the name of an existing one)… usually the default database named postgres will do
run the sql file by running psql in the following manner before entering the psql prompt:
- MacOS, Linux, WSL on Windows:
psql postgres < demo-medium-en-20170815.sql
■ to specify a username:-U someusername
Windows (using cmd.exe for commandline):
psql.exe -U postgres -f c:\tmp\demo-medium-en-20170815.sql postgres
o if you start psql on MacOS by clicking on an icon, you may have to:
“ mdfind -name psqlto get the full path to psql and use that in conjunction
with a -u flag to specify the user; the command will likely look like this:/Library/PostgreSQL/14/bin/psql -Upostgres postgres < demo-
medium-en-20170815.sql
the data will be new a new database called demoso use psql demo to start, or if in
client already, \c demo
Try showing tables and selecting from a t verify import.
。。。