26

I need to select a table, but it's keeping returning error when i tried to using "where" for some column.

here's my code, and i attach an image file for detail.

sirima=# select * from sirima.program_studi;
 kode |      nama       |  jenis_kelas  |          nama_fakultas          | jenjang
------+-----------------+---------------+---------------------------------+---------
    1 | Kedokteran      | Reguler       | Kedokteran                      | S1
    2 | Matematika      | Reguler       | Matematika dan Pengetahuan Alam | S1
    3 | Teknik Sipil    | Reguler       | Teknik                          | S1
    4 | Ilmu Komputer   | Reguler       | Ilmu Komputer                   | S1
    5 | Kedokteran      | Reguler       | Kedokteran                      | S2
    6 | Fisika          | Reguler       | Matematika dan Pengetahuan Alam | S2
    7 | Teknik Sipil    | Reguler       | Teknik                          | S2
    8 | Ilmu Komputer   | Reguler       | Ilmu Komputer                   | S2
    9 | Kedokteran      | Reguler       | Kedokteran                      | S3
   10 | Biologi         | Reguler       | Matematika dan Pengetahuan Alam | S3
   11 | Teknik Sipil    | Reguler       | Teknik                          | S3
   12 | Ilmu Komputer   | Reguler       | Ilmu Komputer                   | S3
   13 | Kedokteran      | Internasional | Kedokteran                      | S1
   14 | Biologi         | Internasional | Matematika dan Pengetahuan Alam | S1
   15 | Teknik Industri | Internasional | Teknik                          | S1
   16 | Ilmu Komputer   | Internasional | Ilmu Komputer                   | S1
   17 | Kedokteran      | Paralel       | Kedokteran                      | S1
   18 | Biologi         | Paralel       | Matematika dan Pengetahuan Alam | S1
   19 | Teknik Industri | Paralel       | Teknik                          | S1
   20 | Ilmu Komputer   | Paralel       | Ilmu Komputer                   | S1
(20 rows)

sirima=# select * from sirima.program_studi where jenis_kelas = "Reguler";
ERROR:  column "Reguler" does not exist
LINE 1: ...t * from sirima.program_studi where jenis_kelas = "Reguler";

ERROR PICT DETAIL

0

2 Answers 2

48

use single quotes:

select * from sirima.program_studi where jenis_kelas = 'Reguler';

https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html:

Sign up to request clarification or add additional context in comments.

3 Comments

Would it kill them to put that in the error message??
Arguably the worst error message I've seen in a decade of programming
@duhaime for sure. spent a few hours trying to debug this.
12

Double quotes are for identifiers while single quotes are for strings.

where jenis_kelas = 'Reguler'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.