Weird error when trying to query from database

52 views Asked by At

As the title suggests, I have no clue why this doesn't work. If someone can point out what I am doing wrong it would be sweet.

Here's the current table rows and cols:

Makes table:

 id |     make      
----+---------------
  1 | Acura

Models Table:

 id  |              model              | makesId 
-----+---------------------------------+---------
   1 | CL                              |       1
   2 | ILX                             |       1
   3 | Integra                         |       1
   4 | Legend                          |       1
   5 | MDX                             |       1
   6 | NSX                             |       1
   7 | RDX                             |       1
   8 | RL                              |       1
   9 | RLX                             |       1

I am trying to query from both tables using a simple line with the WHERE clause with the following query:

SELECT models.model, makes.make 
FROM models, makes 
WHERE models.makesId = makes.id;

funprojectdb=# SELECT models.model, makes.make FROM models, makes WHERE models.makesId = makes.id;

ERROR:  column models.makesid does not exist

LINE 1: ...models.model, makes.make FROM models, makes WHERE models.mak...
                                                         ^

HINT: Perhaps you meant to reference the column "models.makesId".

The goal is to basically show me all of the models associated to the makes id.

1

There are 1 answers

1
jhoangqm On

Thanks to the people that answered my question.

It was an issue with postgres case sensitivity which I completely forgot about.

I will be re-doing the database columns with proper field names.