Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
how to insert value into column of existing table

How to insert value into column of existing table?

I have a table which have 5 column

id | firstname | lastname | address | email                | course_id 
1  | Waleed    | Khan     | Karachi | something@gmail.com  |   null 

This table has 1000 rows but I added course_id column and want to insert value from another table named Courses.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You'll first need to specify what relationship the two tables are sharing. As mentioned in your question you want to create a column_id column in Students table. You'll create this column and then add foreign key constraint to the column. Add the constraint using ALTER TABLE Students ADD CONSTRAINT constraint_name FOREIGN KEY (column_id) REFERENCES Courses(id) ON DELETE CASCADE ON UPDATE CASCADE;

CASCADE on deleteion and updation will take care of record updation and deletion in Students table.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda