Module7_User_Tools Flashcards

1
Q

how to run .sql file on psql without first logging in?

A

psql -f and select file location or

psql -c “command”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

how to save psql output to file

A

psql -o FILENAME
or
\o FILENAME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

how to set variables in PSQL

A

\set NAME MINA
\echo NAME

\unset stops the variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

how to disable autocommit for a session

A

\set AUTOCOMMIT off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

how to see current OS directory in psql and change it

A

! pwd : to see in what directory you are

\cd /new_directory to change directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how to run OS command from psql?

A

! command

How well did you know this?
1
Not at all
2
3
4
5
Perfectly