Questions tagged [cascade]

Cascade refers to a table-definition keyword in relational databases; it instructs the query engine to take a certain action (delete, update), when a primary key is modified, on tables linked by a foreign key.

Cascade is a keyword that helps define the behavior of database tables linked by a foreign key, when the primary table is changed. If cascade is specified in the table definition, then, for example:

  • if a row in the primary table is deleted, the corresponding rows in the linked table can be deleted
  • if a primary key is updated, then the corresponding rows can be updated
1381 questions
-1
votes
1 answer

MySQL Add 2 Primary Keys to the Same table, then reference to them in another table

I have two tables: customers_card and card_info In the customers_card table I have two primary keys: id and cid. In the card_info table I have 1 primary key: id. I want to add 2 foreign keys to the card_info table but I got an error when I try to…
mkiuygfd
  • 45
  • 6
-1
votes
1 answer

Reading a range of bytes from a file in C

I'm trying to write a program that takes a file, and reads bytes from it in different intervals, and assigns them to a variable. This is what I currently have: struct casc_file_parsed { unsigned int targetsize; uint64_t blocksize; …
-1
votes
2 answers

When to set NULL vs CASCADE constraints on a Foreign Key in SQL?

I am learning SQL and particularly progressing at Foreign Keys. I understand the difference between set NULL vs set CASCADE, but not yet clear on the use cases for them. When do you set NULL and when do you set CASCADE for a foreign key?
Quan Bui
  • 175
  • 1
  • 13
-1
votes
4 answers

Hibernate - In a one-to-many relationship, a child loses references to the parent when updating

As in the title, when performing the update operation, the previous child loses the reference to the parent. Parent side @OneToMany(cascade =CascadeType.ALL) @JoinColumn(name = "individual_id") private List contactMedium; Children…
-1
votes
1 answer

How to add cascade argument in XML file format doctrine ORM

as far as I understand I need to add a "cascade" parameter to the mapping. But my mapping is in XML. I found quite a bit of information about it but there was no result. Pleace help! Мy error is: Multiple non-persisted new entities were found…
-1
votes
2 answers

Delete records from relational database with no cascade involved

I need to delete records from relational database, where I attempt to start from the lowest children in the database. I'm not very strong on how to approach the task. I don't want to do CASCADE delete, I actually want to do the opposite of…
Mindan
  • 979
  • 6
  • 17
  • 37
-1
votes
2 answers

Cascade=delete doesn't delete related entities

I do have 2 entities: 1. User 2. Limits User has a set of limits, so one-to-many relation is present. I do have a cascade type set to delete, so when User is deleted, all corresponding limits should be deleted as well.
Maciaz
  • 1,084
  • 1
  • 16
  • 31
-1
votes
1 answer

how to let opencv cascade classifier output a non-square ROI

I am trying to use opencv to train a cascade classifier. The object I am detecting has non-square shape. In training data set, the ROI I drew is non-squared (height > width). However, after training, the classifier outputs always have same width and…
fnhdx
  • 321
  • 2
  • 5
  • 14
-1
votes
1 answer

How to turn on CASCADE in SQL Server 2008 table relationship?

I have 5 tables that are connected together: Table A Table B Table C Table D Table E Table A PK is Code column. Table B PK is Code column. Table C PK is Number column. Table D PK is Number column. Table E PK is Name column. Relationship between…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
-1
votes
1 answer

Updating Two Tables At The Same Time T-SQL

I have created a table called Sales_Details_Store1 and a second table called Sales_Store1. They are tied together using RI with Sale_ID (increment 1,1 of bigint type) being the PK in the Sales_Store1 table and the FK being the Sale_ID (bigint) in…
AriG23
  • 3
  • 2
-1
votes
1 answer

Variable that changes each time I creat an instense of a class

I'm trying to create a class that will take name and cascade as params and will add an item to the GUI's menu (using tkinter). The code looks like this: from tkinter import * class new_menu_item: def __init__(self, name, cascade): …
NotSoShabby
  • 3,316
  • 9
  • 32
  • 56
-1
votes
2 answers

delete from another 2 tables when delete from a table based on 2 field condition

In MySQL server, I have 3 tables called user, thing, thingfile user uid, username, name, location, version thing thingid, username,, version thingfile thingid, code, version Each user has many things and each thing has many thingfiles. I am…
MT467
  • 668
  • 2
  • 15
  • 31
-1
votes
1 answer

Cascading Number MySQL

Ok I'm new with MySQL so excuse any stupid questions and such but I'm having a problem with the simple database table I created. See: I have it set up so each new entry has a automatically incrementing id however if I were to delete the third row,…
Spedwards
  • 4,167
  • 16
  • 49
  • 106
-1
votes
2 answers

MySQL - Query for foreign key CASCADE behaviors

Is it possible to query MySQL to determine a FK's CASCADE behavior? Currently I'm doing this: SELECT COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = 'my_db' …
Madbreaks
  • 19,094
  • 7
  • 58
  • 72
-1
votes
1 answer

Cascade copy in oracle

I would like to make a cascade copy. I have a MODEL and the specification of this MODEL is stored in 4 tables and one MODEL is identificated by MODEL_ID in the tables. The MODEL_ID of the MODEL is primary key and the MODEL_ID is increased one by…
user2342549
  • 45
  • 1
  • 2
  • 9
1 2 3
91
92