Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

292
Vistas
How do i insert values into a column within a specific row in PostgreSQL?

I'm trying to insert table values into my postgreSQL database into a certain row but struggling, any ideas?

The code I've been using is the following but it keeps returning errors.For clarity, applicationname and applicationemail are the values and role_id is personal to the row.

I know the following code is wrong but it's the closest line i can think of achieving it.

Where am i going wrong?

    await pool2.query(
      "INSERT INTO contracts (applicationname, applicationemail) VALUES ($1, $2) WHERE role_id = $3",
      [name, email, role_id]
    );

*disclaimer, I'm recently new to coding any help would be much appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

First, the obvious error is syntaxis error: INSERT command does not have WHERE clause. This is the reason for the raisng error.

The second error is logical: INSERT command adds a NEW row in the table. To modify the EXSITNG row you need UPDATE command it has WHERE clause (as sad @a_horse_with_no_name)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda