Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql modify foreign key

-- 2 Step process
ALTER TABLE tbl_name_1 DROP FOREIGN KEY fk_name;
ALTER TABLE tbl_name_1 ADD FOREIGN KEY fk_name(fk_col)
            REFERENCES tbl_name_2(pk_name) ON DELETE RESTRICT;


-- Use to find the name of the FOREIGN KEY 
SHOW CREATE TABLE tbl_name;
Comment

update foreign key value in mysql

SET foreign_key_checks = 0;
UPDATE languages SET id='xyz' WHERE id='abc';
UPDATE categories_languages SET language_id='xyz' WHERE language_id='abc';
SET foreign_key_checks = 1;
Comment

PREVIOUS NEXT
Code Example
Sql :: pagination in sql 
Sql :: insert into values select 
Sql :: sub query in linq 
Sql :: unique key in ms sql server 
Sql :: intellij mysql set timezone 
Sql :: sql if example 
Sql :: how to select random rows from a table 
Sql :: sqlalchemy empty table 
Sql :: call postgres function 
Sql :: SQL CASE With ELSE in SQL 
Sql :: sql greater than 
Sql :: insert in to table sql 
Sql :: update table mysql 
Sql :: mysql random 
Sql :: sql query to check if column contains alphabets 
Sql :: oracle simple quote 
Sql :: mysql default value 
Sql :: Using GROUP BY in MySQL Join Table 
Sql :: sql ending with vowels 
Sql :: pg_pretty_size 
Sql :: select database in mysql 
Sql :: mysql on duplicate key ignore 
Sql :: how to get all dates in a month in oracle 
Sql :: restart mysql 
Sql :: sql search all tables for attributes 
Sql :: mysql composite primary key 
Sql :: how to force truncate a table in mysql 
Sql :: bigquery current time 
Sql :: datagrip exec 
Sql :: oracle get foreign keys on table 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =