Linked Questions

0 votes
1 answer
95 views

I've created two tables: 1.Table CREATE TABLE IF NOT EXISTS us_tAddress ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, country VARCHAR(100), city VARCHAR(100), zip VARCHAR(100), street ...
Random2020's user avatar
473 votes
11 answers
683k views

Please clarify two things for me: Can a Foreign key be NULL? Can a Foreign key be duplicate? As fair as I know, NULL shouldn't be used in foreign keys, but in some application of mine I'm able to ...
Amit's user avatar
  • 22.2k
26 votes
6 answers
47k views

I am trying to use Code-First EF6 with default SQL values. For example, I have a "CreatedDate" column/property not null with a default in SQL of "getdate()" How do I represent this in my code Model?...
Carl's user avatar
  • 2,305
7 votes
5 answers
2k views

I have a legacy Oracle database that has a strange quirk I wanted to make sense of. It has a composite foreign key where some columns are nullable. To me this smells like a bad design by a careless ...
The Impaler's user avatar
  • 49.3k
4 votes
2 answers
8k views

My model is like this public class Appointment { public int AppointmentID { get; set; } public string AppointmentCode { get; set; } public string ApplicationUserId { get; set; } [...
None's user avatar
  • 5,688
4 votes
1 answer
3k views

Using Firebird 2.1. While refactoring a large system I want to create a foreign key between tables that both are already populated: ALTER TABLE CMS_ARTRANS ADD CONSTRAINT FK_ARTRANS_PRACTITIONER_ID ...
Marian Aldenhövel's user avatar
2 votes
3 answers
7k views

CREATE TABLE [M].[SocialInfo] ( [Id] UNIQUEIDENTIFIER NOT NULL PRIMARY KEY DEFAULT newid(), [MemberId] UNIQUEIDENTIFIER DEFAULT newid(), [GroupId] UNIQUEIDENTIFIER DEFAULT newid(), ...
Neo's user avatar
  • 16.3k
2 votes
2 answers
4k views

I have this problem: I have this table which has 5 columns: ID, Usuario_IdUsuario, Artista_IdArtista, Disco_IdDisco, Lista_IdLista. The last 4 are foreign keys, and the last 2 allow nulls, because at ...
Javier González's user avatar
0 votes
1 answer
3k views

I have two tables in my database, one for admins (named Admins) and the other one for normal users, named : utilisateurs (in french). I know i have to use cakePHP's convention which says i must create ...
codeless's user avatar
  • 145
0 votes
2 answers
2k views

I have 'parent' and 'child' tables. There is a column 'parent_id' in 'child' table and it is a foreign key. 'id' column in 'parent' table is NOT NULL and INT. 'parent_id' is also INT but DEFAULT NULL. ...
Yelnar's user avatar
  • 674
0 votes
2 answers
1k views

I have tables like this: Notes ID | NAME | CATEGORY 1 | test | 1 2 | test2| 2 Notes Category ID | NAME | COUNT 1 | tCat | 1 2 | tCat2| 1 And I have foreign key CATEGORY <-> Notes Category....
Krzyś Iu's user avatar
2 votes
2 answers
907 views

I've been working on this for hours and can't figure out how to insert/update NULL values for columns. For example, I have a block of code case 'add': { $message = $wpdb->insert('...
user avatar
0 votes
1 answer
618 views

We have the following table and we ran into an issue that our unique key is not working (as expected). CREATE TABLE `documentation_photos` ( `commissionID` smallint(5) unsigned NOT NULL, `periodID`...
Akxe's user avatar
  • 11.8k
0 votes
1 answer
339 views

I have several tables which I want to reference to a particular table tools. I have multiple foreign keys assigned to this table. Some times, these foreign keys may not have values but sometimes they ...
user1012181's user avatar
  • 8,726
0 votes
2 answers
171 views

So, I was using mysql server on Centos 6 and it was alright then, I shifted my code to Centos 7 server. I had a constraint in an table where I used to insert null values by default in MySQL Server. I ...
legalimpurity's user avatar

15 30 50 per page