About 437,000 results
Open links in new tab
  1. How do I create a foreign key in SQL Server? - Stack Overflow

    I have never "hand-coded" object creation code for SQL Server and foreign key decleration is seemingly different between SQL Server and Postgres. Here is my sql so far: drop table …

  2. mysql - Add Foreign Key to existing table - Stack Overflow

    I had to run "SET FOREIGN_KEY_CHECKS=0;" before running the ADD CONSTRAINT command or SQL would complain "Cannot add or update a child row: a foreign key constraint …

  3. Add new column with foreign key constraint in one command

    Jul 15, 2013 · I am trying to add a new column that will be a foreign key. I have been able to add the column and the foreign key constraint using two separate ALTER TABLE commands: …

  4. Como adicionar uma foreign key em uma tabela já criada

    Jan 30, 2016 · Resolvido - A primary key da tabela 'pessoa' estava como 'unsigned' então houve uma incompatibilidade de tipo de dados. Porém pude sanar muitas dúvidas a respeito de …

  5. mysql - ERROR 1452: Cannot add or update a child row: a foreign …

    Feb 9, 2014 · Cannot add or update a child row: a foreign key constraint fails essentially means that, you are trying to add a row to your Ordrelinje table for which no matching row (OrderID) is …

  6. sql - How to add a column and make it a foreign key in single …

    In mysql, can I add a column and foreign key in the same statement? And what is the proper syntax for adding the fk? Here is my SQL: ALTER TABLE database.table ADD COLUMN …

  7. sql server - Add a column with a foreign key to an existing table ...

    Apr 3, 2024 · How to add a column with a foreign key to an existing table so that it refers to the appropriate unit (ID) values?

  8. Adding named foreign key constraints in a SQL Create statement

    Nov 9, 2016 · In SQL Server, you can use the constraint keyword to define foreign keys inline and name them at the same time. Here's the updated script:

  9. How to add foreign key in PostgreSQL - Stack Overflow

    Aug 23, 2021 · create table bookstore (book_name varchar primary key, author varchar, price decimal); I am trying to create a second table named 'name' where name is primary key. I …

  10. Adding a foreign key to existing table - Stack Overflow

    ALTER statement for a multiple FOREIGN KEYS does not work. Each CONSTRAINT should be added individually : CREATE TABLE Gust ( Gust_ID INT PRIMARY KEY, First_Name …