Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!