I need to create a database using sql for my reviews site. I tried to use the on delete and on update constraints but I'm not sure if they are right. I created three tables a 'cars'(my review items) 'reviews'(holds the reviews) and a 'users' one. I linked cars_id and users_id with reviews table. I used on update cascade and on delete cascade for both. I'm not sure if that's right. Can someone help me understand them more?
SQL Confused over ON UPDATE and ON DELETE
138 Views Asked by user3183658 At
1
There are 1 best solutions below
Related Questions in SQL
- SQL schema for a fill-in-the-blank exercise
- Hibernate: JOIN inheritance question - why the need for two left joins
- What's supposed to be the problem in this query?
- Compare fields in two tables
- How to change woocomerce or full wordpress currency with value from USD to AUD
- Dynamic query creation with Array like implementation
- SQL query to get student enrolled in this month in a course - Moodle
- SQL LAG() function returning 0 for every row despite available previous rows
- Convert C# DateTime.Ticks to Bigquery DateTime Format
- Use row values from another table to select them as columns and establish relations between them (pivot table)
- SQL: Generate combination table based on source and destination column from same table
- how to use system's environnement variables in sql script
- PHP fetchAll on JOIN
- Multitable joining in Sql
- How to display name starting from 'z' by using BETWEEN cmd only?
Related Questions in CASCADE
- cascade.Persist in @ManyToMany how does it work generally and how does it work in this situation
- how to use cascade dropdown in serenity?
- AFTER DELETE trigger fires only if a DELETE is executed on a db query but not on EF Core
- Creating Interdependant CascadeChoiceParameter in jenkins
- Why would a check constraint be violated on a cascade delete?
- JPA Mappings (OneToMany, ManyToOne)
- Orphan removal in Spring Boot entity class is removing everything, not just orphans
- codeigniter 3, sqlite3 : delete query builder cascade not working
- With enableLazyInitialization = true, I am not able to save the Entity Object with CascadeType None
- Can't save Main Object with giving only ID of Nested Object - giving TransientObjectException Many to many relationship is used
- How to implement Cascading in NHibernate using ClassMap (mapping by code)?
- As a system architecture, should I encourage the team to use cascade characteristic of spring JPA?
- deleteById() method not working with ManyToMany mapping: Spring Boot and JPA
- Cascade delete in Laravel
- PostgreSQL column "id" referenced in foreign key constraint does not exist SQL state: 42703
Related Questions in CASCADING-DELETES
- Unidirectional Many-to-One Mapping : Can't delete child data JPA Spring Boot
- orphanRemoval does not work in OneToOne relationship
- Asking for advice on debugging a not-working JPA delete call
- .relationship(…, cascade="all") does not delete children when multiple parents "bulk" deleted using session.execute(delete(Parent))
- Prisma model error, provider mysql using nextjs
- How to optimaly delete records from a parent and associated children table
- How to remove orphan children when parent is saved
- Django ManyToMany creations and cascading deletions
- Getting exception when deleting entities with `DeleteBehavior.ClientCascade` defined
- Issue with Deleting Records in Laravel Eloquent
- On delete cascade with TOP never returns
- Cascading delete for EF sqlite database tables
- Deleting a Realm object in a SwiftUI List with cascading delete
- How to cascade a DELETE in GORM?
- Does the CASCADE constraint work with a HasMany model?
Related Questions in RESTRICT
- Limit object movement to one axis only in Powerpoint
- Restrict putty agent ssh forwarding of vscode on remote host for specific ips
- How can I give access to only a single Google Analytics 4 (GA4) report?
- In VBA, how to hide files and share only with specific users in a Teams channel?
- how can I exclude ddl excution in liquibase
- Hiding/restricting parts of the source code in a git repository for team members and freelancers
- How to restrict cell input field of a looped row , which accept alphanumeric and special character except . or decimal point?
- Woocommerce: Restrict payment gateway redirection for custom payment method and create popup modal at checkout to process payment
- .htaccess: Why I can't restrict access to certain file extensions?
- Download Vimeo blocked video
- Entity Framework Core DeleteBehavior for not to take action
- Stop My Program and Another Program From Receiving REAL User Input
- Detect and stop Airplay on WKWebView that plays a video
- VSCode - Restrict editing in certain sections
- Use typescript to type function argument and return full argument type
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
It is a matter of data modelling.
Ask yourself the question:
"If I delete a car, do I want to delete the relational records of other tables too?"
If YES put it to CASCADE etc.
Or:
"If I delete a user, do I want to delete his cars too?"
"If I delete a car, do I want do delete the corresponding user too?"
Maybe a good idea to read first here:
http://en.wikipedia.org/wiki/Relational_database
and then here: http://dev.mysql.com/doc/refman/5.1-olh/de/innodb-foreign-key-constraints.html