Let's create a basic users
table with sample data:
CREATE TABLE users (
id serial PRIMARY KEY,
name text
);
INSERT INTO users ('name') VALUES ('Bob'), ('Tom'), ('Sam');
Then SELECT * FROM users
to see what we're working with:
id | name
----+------
1 | Bob
2 | Tom
3 | Sam
Now check out what happens when we SELECT users FROM users
:
users
----------
(1,Bob)
(2,Tom)
(3,Sam)
That's pretty interesting! Postgres returns a tuple containing all of the columns for each row in users
.