# psql console

1. Start a Windows command console or powershell
2. Connect to PostgreSQL with

```
psql -U postgres
```

The password is CompSys2025!

<figure><img src="https://1749606007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXAgEjzme0UjNlyTf4TFz%2Fuploads%2FOXhNM9OYQP5No3UK5slP%2F1742832891918.png?alt=media&#x26;token=e86c1448-a5ef-4dae-86ee-247565f00e11" alt=""><figcaption></figcaption></figure>

2. List databases

```
\list
```

or&#x20;

```
\l
```

3. Connect to database bookshop

```
\c bookshop
```

4. Display tables in database bookshop

```
\dt
```

or

```
\dt+
```

5. Show table schemas

```
\d tablename
```

<figure><img src="https://1749606007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXAgEjzme0UjNlyTf4TFz%2Fuploads%2FsLaohHb18WlsbCCNEJIT%2Fimage.png?alt=media&#x26;token=7a000b48-dc38-4d81-9f30-175e31c34546" alt=""><figcaption></figcaption></figure>

5. Run your SQL statements, such as

```
SELECT * from books
```

<figure><img src="https://1749606007-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXAgEjzme0UjNlyTf4TFz%2Fuploads%2FDNS0c4wUbV5xGfBPudKK%2Fimage.png?alt=media&#x26;token=e8af0f37-773f-4f67-837e-d0de3ed6cffd" alt=""><figcaption></figcaption></figure>
