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 PGCES-02 Exam - Topic 1 Question 98 Discussion

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.
A) \copy t1 FROM users.dat WITH DELIMITER ':'
B) \copy t1 TO users.dat WITH DELIMITER ':'
C) INSERT INTO t1 FROM file('users.dat');
D) INSERT INTO t1 SELECT uname, pass, id FROM file('users.dat');
E) \insert t1 FROM users.dat WITH DELIMITER ':';

PostgreSQL PGCES-02 Exam - Topic 1 Question 98 Discussion

Actual exam question for PostgreSQL's PGCES-02 exam
Question #: 98
Topic #: 1
[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

Contribute your Thoughts:

0/2000 characters
I think A is the right choice.
upvoted 0 times
...
Regenia
5 days ago
C seems off, not sure it works like that.
upvoted 0 times
...
Melissa
10 days ago
Definitely A, it’s the standard way to import data.
upvoted 0 times
...
Kasandra
15 days ago
Wait, can you really use file() in SQL?
upvoted 0 times
...
Dorothy
2 months ago
I think B is better, though.
upvoted 0 times
...
Glendora
2 months ago
A is the right choice!
upvoted 0 times
...
Lauran
3 months ago
I recall that using INSERT INTO with a file isn't standard SQL syntax, so options C and D seem wrong to me.
upvoted 0 times
...
Becky
3 months ago
I feel like option B is about exporting data, not importing, so it can't be the right choice here.
upvoted 0 times
...
Lea
3 months ago
I'm not entirely sure, but I remember practicing with \copy commands, and it seems like the right approach for importing data.
upvoted 0 times
...
In
3 months ago
I think option A is correct because it uses \copy to load data from a file into the table.
upvoted 0 times
...

Save Cancel