Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

PostgreSQL Exam PGCES-02 Topic 8 Question 70 Discussion

Actual exam question for PostgreSQL's PGCES-02 exam
Question #: 70
Topic #: 8
[All PGCES-02 Questions]

I would like to insert the contents of the text file users.dat into the table t1 using psql.

Contents of text file users.dat: Definition of table t1: CREATE TABLE t1 (uname TEXT, pass TEXT, id INTEGER); Select the most appropriate input from those below.

Show Suggested Answer Hide Answer
Suggested Answer: A, E

Contribute your Thoughts:

Cora
2 months ago
I heard the table t1 is where they keep all the secret agent passwords. Time to get hacking!
upvoted 0 times
...
Avery
2 months ago
B) is the opposite of what we want to do. We're trying to import data, not export it.
upvoted 0 times
...
Giovanna
2 months ago
E) is just plain wrong. \\insert isn't even a valid psql command.
upvoted 0 times
Jacqueline
20 days ago
D) INSERT INTO t1 SELECT uname, pass, id FROM file('users.dat');
upvoted 0 times
...
Desmond
1 months ago
B) \\copy t1 TO users.dat WITH DELIMITER ':'
upvoted 0 times
...
Stephen
2 months ago
A) \\copy t1 FROM users.dat WITH DELIMITER ':'
upvoted 0 times
...
...
Weldon
3 months ago
D) looks good, but it's not the most appropriate answer. We need a way to directly import the file, not select from it.
upvoted 0 times
Frederick
1 months ago
D) INSERT INTO t1 SELECT uname, pass, id FROM file('users.dat');
upvoted 0 times
...
Cassie
2 months ago
B) \copy t1 TO users.dat WITH DELIMITER ':'
upvoted 0 times
...
Adell
2 months ago
A) \copy t1 FROM users.dat WITH DELIMITER ':'
upvoted 0 times
...
...
Jesus
3 months ago
A) is the correct answer. The \\copy command is used to import data from a file into a table, not the other way around.
upvoted 0 times
Arthur
1 months ago
D) is not the correct answer. The correct syntax for importing data from a file into a table is \\copy t1 FROM users.dat WITH DELIMITER ':'.
upvoted 0 times
...
Marjory
1 months ago
B) is not the correct answer. The \\copy command is used to import data from a file into a table, not export data from a table to a file.
upvoted 0 times
...
Clorinda
2 months ago
A) is the correct answer. The \\copy command is used to import data from a file into a table, not the other way around.
upvoted 0 times
...
...
Mertie
3 months ago
I'm not sure about the answer. I think it might be D) INSERT INTO t1 SELECT uname, pass, id FROM file('users.dat').
upvoted 0 times
...
Jade
3 months ago
I agree with Mariann. Option A seems to be the most appropriate choice for inserting the contents of the text file into the table.
upvoted 0 times
...
Mariann
4 months ago
I think the correct answer is A) \\copy t1 FROM users.dat WITH DELIMITER ':' because it is used to copy data from a file into a table in psql.
upvoted 0 times
...

Save Cancel