foreign-keys Questions

41

Solved

I'm trying to create foreign keys in Laravel however when I migrate my table using artisan i am thrown the following error: [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 121...
Cammycamomile asked 24/3, 2014 at 17:4

11

I am trying to set foreign key of my 'books' table with 'categories' table using php artisan migrate, but I got the following error: Illuminate\Database\QueryException SQLSTATE[HY000]: General...
Caravel asked 24/3, 2020 at 7:5

2

Solved

I have two simple beans--FatKid and Hamburgers. I need to be able to not only look up all of the hamburgers someone ate, but also who ate which particular hamburger. FatKid.java import java.util.Li...
Atlas asked 23/10, 2011 at 21:45

15

Solved

I found some threads about the error. But all the solutions doesn't work for me. I created 2 tables a user table and one for articles. Now I want to store the user that created the article and the...
Unclasp asked 12/10, 2014 at 20:43

1

Solved

I have a menu that can have multiple Sections. I have passed the menuID of a ShopMenuEntity as foreign key in ShopSectionEntity with name fk_menu_id. Both id's have to be autoGenerated in ShopMenu ...

9

Solved

Does Postgres automatically put indexes on Foreign Keys and Primary Keys? How can I tell? Is there a command that will return all indexes on a table?
Frankel asked 9/6, 2009 at 14:56

3

Solved

I've read a few places (see the second answer) that one-to-one relationships in Django models should almost always only be used for inheritance, or to access an otherwise inaccessible model (like t...
Amanda asked 8/8, 2014 at 15:1

12

Solved

What's the difference between Django OneToOneField and ForeignKey?
Rempe asked 3/5, 2011 at 13:54

31

Solved

Is there a way using SQL to list all foreign keys for a given table? I know the table name / schema and I can plug that in.
Ad asked 20/7, 2009 at 8:14

5

Solved

I know the question of how to update multiple tables in SQL has been asked before and the common answer seems to be do them separately in a transaction. However, the 2 columns I need to update hav...
Samp asked 29/3, 2012 at 8:46

13

Solved

Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Sup_Item_Sup_Item_Cat". The conflict occurred in database "dev_bo", table...
Therontheropod asked 3/6, 2010 at 12:24

6

Solved

I'm building a small application and setting up foreign key relationships between tables. However I'm confused as to WHY I really need this? What is the advantage - does it assist me when writing m...
Akela asked 8/8, 2010 at 15:53

26

Solved

So I'm trying to add Foreign Key constraints to my database as a project requirement and it worked the first time or two on different tables, but I have two tables on which I get an error when tryi...
Quietly asked 20/3, 2013 at 21:21

3

Solved

In the SQLite FAQ[1] it is mentioned that SQLite does not have full ALTER TABLE support. In a previous question on StackOverflow [2] a trick is mentioned to accomplish table modifications. What I ...
Chengtu asked 4/2, 2011 at 12:17

4

Solved

I have two tables built like this (this is just a simplified and non-proprietary example): Person Table ----------- p_Id, f_name, l_name Job Table ---------- job_Id, job_desc I want to add a fo...
Through asked 8/2, 2012 at 19:9

3

Solved

I'm trying to replicate a SQL database in Cassandra, but, while I had no problem creating the tables, I found that I cannot find an example easy to understand that shows how I can create foreign ke...
Aldana asked 28/12, 2014 at 13:46

3

Solved

I have two tables with a one-to-one relationship, set by a foreign key constraint. I want to set the onDelete rule to 'set default', meaning that when a row on the foreign table is dropped, the ref...
Readytowear asked 23/12, 2016 at 13:39

30

Solved

I am trying to forward engineer my new schema onto my database server, but I can't figure out why I am getting this error. I've tried to search for the answer here, but everything I've found has sa...
Bedel asked 6/6, 2013 at 18:4

9

Solved

Why do I have a problem creating a table using Laravel Migrations Schema Builder? The problem occurs with a table with a self-referencing foreign key. Schema::create('cb_category', function($table)...
Brushoff asked 25/8, 2013 at 9:10

15

Solved

Simple question: I'm new to Laravel. I have this migration file: Schema::create('lists', function(Blueprint $table) { $table->increments('id'); $table->string('title', 255); $table...
Spelling asked 18/10, 2014 at 7:26

4

Solved

I’m trying to add a ForeignKey field to a Django model using South. I’m getting the following error: ValueError: You cannot add a null=False column without a default value. I did, in fact, specif...
Tish asked 16/8, 2011 at 15:9

3

Solved

I have the following code: subject = models.ForeignKey(subjects) location = models.ForeignKey(location) publisher = models.ForeignKey(publisher) It is possible that I won't have all three values o...
Randi asked 8/7, 2011 at 4:28

11

I've created a table in MySQL: CREATE TABLE actions ( A_id int NOT NULL AUTO_INCREMENT, type ENUM('rate','report','submit','edit','delete') NOT NULL, Q_id int NOT NULL, U_id int NOT NULL, date DAT...
Verniavernice asked 19/12, 2008 at 3:51

3

Solved

I have a two tables. Table a looks something like this -- first row is column names, both contain characters: id | tractce | someString 1 | "0011900" | "Label here" Table b: id | tractFIPS 1 |...
Pily asked 29/1, 2018 at 21:33

3

Solved

I want to get table names ordered by it's dependency order. For example: If I have table users, users_orders and orders I want to get table names this order: users (or orders does not matter), ord...
Brittani asked 27/6, 2017 at 15:46

© 2022 - 2024 — McMap. All rights reserved.