referential-integrity Questions

4

Solved

I would like to add a constraint that will check values from related table. I have 3 tables: CREATE TABLE somethink_usr_rel ( user_id BIGINT NOT NULL, stomethink_id BIGINT NOT NULL ); CREATE T...

5

Solved

I have a table with this layout: CREATE TABLE Favorites ( FavoriteId uuid NOT NULL PRIMARY KEY, UserId uuid NOT NULL, RecipeId uuid NOT NULL, MenuId uuid ); I want to create a unique constrain...

2

Solved

There is this field in a table: room_id INT NOT NULL CONSTRAINT room_id_ref_room REFERENCES room I have three 2 tables for two kinds of rooms: standard_room and family_room How to do something ...

3

Solved

I have the following scenario in a Postgres 9.3 database: Tables B and C reference Table A. Table C has an optional field that references table B. I would like to ensure that for each row of tabl...

5

Solved

In a discussion with a friend, I got to hear two things - Using constraints causes slight decrease in performance. eg. Consider a uniqueness constraint. Before insertion, DBMS would have to chec...
Pameliapamelina asked 1/10, 2016 at 7:21

2

Solved

In a PostgreSQL 9.3 database, if I define tables a and b as follows: CREATE TABLE a(i integer); ALTER TABLE a ADD CONSTRAINT pkey_a PRIMARY KEY (i); CREATE TABLE b(j integer); ALTER TABLE b add CO...

2

When you search for referential integrity in relation to Mongo-DB the standard response is "MongoDB does not support this". The standard explanation is that MongoDB supports refs and populate...
Consalve asked 1/6, 2019 at 0:17

4

Can a single column in a table can be referenced to multiple tables?

2

Solved

Should a command handler also check for referential integrity? This FAQ suggest that you shouldn't check this in the aggregates (http://cqrs.nu/Faq). Isn't checking that something exists part of th...
Iso asked 9/8, 2017 at 7:51

3

Solved

I am new to CouchDB and learning about it. I did not come across CouchDB support for referential integrity. Can we create a foreign key for a field in the CouchDB document? For e.g. Is it possibl...
Excruciate asked 23/12, 2009 at 6:36

1

First of all, let me state that I am new to Command Query Responsibility Segregation and Event Sourcing (Message-Drive Architecture), but I'm already seeing some significant design benefits. Howeve...

3

Solved

Assuming I have two tables: users and orders. A user has many orders, so naturally there is a foreign key user_id in my orders table. What is the best practice in rails (in terms of speed, style a...
Customable asked 23/9, 2012 at 21:58

7

Solved

Google results on this one are a bit thin, but suggest that it is not easily possible. My specific problem is that I need to renumber the IDs in two tables that are related to each other such that...
Marilou asked 26/9, 2008 at 14:29

3

Solved

I have two tables, object and object_data, with object referencing object_data by foreign key (the relation is 1:1). For a set of objects, I need to null their object_data references and delete the...
Jasper asked 27/3, 2015 at 16:32

1

Solved

I have a large SQL 2012 database (100 tables), in which I need to find all constraints where the referential action is set to CASCADE (update or delete). In this useful answer I see that I can lis...
Tense asked 16/3, 2015 at 16:54

4

Solved

First, sorry for my poor English... I got four entities : User, Application, Bundle & Entity. Here are their relations (with cascading persist & remove, see code below) : User 1-n Applic...
Peppard asked 10/1, 2013 at 11:33

1

I am trying to update an entity in EF6. I have read that if I wish to change a ForeignKey property, I have to then ensure the Navigation Property is the correct one, or set it to null. I have take...
Korwin asked 15/8, 2014 at 2:6

3

Solved

I have a model that defines mutually recursive tables: Answer questionId QuestionId text Question text correct AnswerId What do I need to do to actually insert a question? I need to know what...

4

Solved

You cannot delete a row if any row is referencing the row to delete via a FK. Is it possible to know if any row is referencing the row to delete before executing a DELETE statement?
Orthoclase asked 10/6, 2011 at 4:24

1

Solved

I have a table user with userID as the primary key. I have another table called Friends. In the Friends table, I have two Users as friends represented by the columns UserID and FrndID where both Us...

6

Solved

Given the schema: What I need is having every user_identities.belongs_to reference an users.id. At the same time, every users has a primary_identity as shown in the picture. However when I try...
Palmate asked 29/9, 2012 at 11:3

1

Solved

I have a Django web-server configured to use SQLite. In a many-to-many relationship (with extra fields), Django forces me to use the relationship model to establish a relationship between two obje...
Dorsoventral asked 20/6, 2013 at 12:17

5

Solved

I have the following database schema: members_company1(id, name, ...); members_company2(id, name, ...); profiles(memberid, membertypeid, ...); membertypes(id, name, ...) [ { id : 1, name : 'comp...
Overlying asked 10/4, 2013 at 20:6

2

Solved

I have an example situation: parent table has a column named id, referenced in child table as a foreign key. When deleting a child row, how to delete the parent as well if it's not referenced by a...

2

Solved

Rails does not support referential integrity foreign keys. How do I manage this? Ideally the app should not have to deal with this; the database should. Do plugins like Foreigner have shortcomings?...
Limit asked 9/8, 2010 at 9:25

© 2022 - 2024 — McMap. All rights reserved.