11/18/2023 0 Comments Cascade delete postgres![]() ![]() SET NULL It is used in conjunction with ON DELETE or ON UPDATE. It means that the child data is either deleted or updated when the parent data is deleted or updated. ![]() CASCADE It is used in conjunction with ON DELETE or ON UPDATE. It means that no action is performed with the child data when the parent data is deleted or updated. NO ACTION It is used in conjunction with ON DELETE or ON UPDATE. ![]() You have the options of NO ACTION, CASCADE, SET NULL, or SET DEFAULT. It specifies what to do with the child data when the parent data is updated. ON DELETE CASCADE It specifies that the child data is deleted when the parent data is deleted. The foreign key will enforce a link between this data and the child_col1, child_col2. parent_col3 The columns that make up the primary key in the parent_table. parent_table The name of the parent table whose primary key will be used in the child_table. child_col_n The columns in child_table that will reference a primary key in the parent_table. fk_name The name of the foreign key constraint that you wish to create. The column should either be defined as NULL or NOT NULL and if this value is left blank, the database assumes NULL as the default. column1, column2 The columns that you wish to create in the table. ) child_table The name of the child table that you wish to create. REFERENCES parent_table (parent_col1, parent_col2. The syntax for creating a foreign key with cascade delete using a CREATE TABLE statement in SQL Server (Transact-SQL) is: CREATE TABLE child_tableįOREIGN KEY (child_col1, child_col2. Create Foreign key with cascade delete - Using CREATE TABLE statement Syntax ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |