About 527,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 exams; drop table

  2. Cannot truncate table because it is being referenced by a FOREIGN KEY ...

    Oct 31, 2008 · Because TRUNCATE TABLE is a DDL command, it cannot check to see whether the records in the table are being referenced by a record in the child table. This is why DELETE works …

  3. sql - Joining tables on foreign key - Stack Overflow

    I have the following three tables: Product Purchase (contains ProductID as foreign key) Sale (contain ProductID as foreign key as well) I want to form query joining these 3 tables where my result...

  4. sql - Can table columns with a Foreign Key be NULL? - Stack Overflow

    the foreign key, cannot be null by default in mySQL, the reason is simple, if you reference something and you let it null, you will loose data integrity. when you create the table set allow null to NOT and …

  5. sql - Does Foreign Key improve query performance? - Stack Overflow

    Foreign key constraint improve performance at the time of reading data but at the same time it slows down the performance at the time of inserting / modifying / deleting data. In case of reading the …

  6. How to create a foreign key in phpmyadmin - Stack Overflow

    Jun 3, 2016 · To generate a foreign key you need to create first index of that field.After you create an index.Then go to relation view you will see that field also along with primary key .

  7. How do I drop a foreign key in SQL Server? - Stack Overflow

    Sep 18, 2008 · I have created a foreign key (in SQL Server) by: alter table company add CountryID varchar (3); alter table company add constraint Company_CountryID_FK foreign key (CountryID) …

  8. How can I list all foreign keys referencing a given table in SQL Server ...

    Jan 27, 2009 · I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table? (SQL answers …

  9. sql - Can a foreign key be NULL and/or duplicate? - Stack Overflow

    Mar 11, 2017 · By default there are no constraints on the foreign key, foreign key can be null and duplicate. while creating a table / altering the table, if you add any constrain of uniqueness or not null …

  10. Is it fine to have foreign key as primary key? - Stack Overflow

    Jun 11, 2012 · It is perfectly fine to use a foreign key as the primary key if the table is connected by a one-to-one relationship, not a one-to-many relationship. If you want the same user record to have the …