Questions tagged as 'chave-estrangeira'

3
answers

Can a primary key be used on a foreign key?

Can the following example occur? | Id | nome | data | qnt | PK -> Id FK -> (Id, qnt) Or are there any restrictions?     
asked by 16.10.2014 / 02:29
1
answer

Linking of SQL tables by means of string instead of id

User accounts data id nome sobrenome pais estado cidade telefone url_perfil User login data id email senha prioridade My questions are: How can I bind them to foreign key using string ? Is it best...
asked by 24.02.2017 / 13:50
1
answer

Foreign Key Sql Server

I have a doubt refuse the foreign key in the following situation: Tehno the table UF, with 3 columns: ID_UF (PK), Cod_UF (int) and DescUF (nvarchar (50)) I have another table called IDE, with 3 columns: ID_IDE (PK), Cod_UF (int) and...
asked by 30.08.2016 / 17:07
1
answer

Insert into two tables in SQLite Android

How do I add data in two tables on Android in a single transaction? I have two Client and Address tables, the latter with a foreign key referencing the client table, and it must be registered in a single transaction. I know that MySQL has the...
asked by 29.06.2014 / 08:08
2
answers

I can not get a foreign key in PHPMYADMIN

I have my bank already created in phpmyadmin, there are two tables, payments and students. I've seen several tutorials and read various ways how to put a foreign key ( fk_alunos ) of student_id in my payments table, nothing works. Tabl...
asked by 18.09.2018 / 16:42
1
answer

Foreign key with 3 primary keys

Hi. I have this table with 3 primary keys and I need to reference it in another table. How? I was going to just put an id of type int in the monthly fee table to be the only primary key. But each monthly fee must be unique to a contract and h...
asked by 05.07.2018 / 04:56
3
answers

Saving ID of a table with two Primary Keys with Hibernate

Hello, I'm having a problem saving data to a last table. Well, this table has two foreign keys and the same ones are primary keys: WhengoingtotheController,savethetable,Iusethefollowingcodes:itv.setId();itv.setIngresso(ing);itv.setVenda(ven)...
asked by 29.05.2016 / 23:37
1
answer

multiple foreign keys SQL [closed]

I have the following table: items (ref) attribute "ref" as the primary key of the table, may have associated several child keys in other tables [eg table1 (ref) and table2 (ref) being "ref" key secondary of the respective tables]?     
asked by 03.05.2017 / 22:43
1
answer

Self-relationship in mysql

I am trying to implement a table in MYSQL with self-relationship, it is a staff registry table, in which the administrator (FA) registers the common employee (FC) It would be registered in the tuple of the FC which FA registered it, I created th...
asked by 26.09.2016 / 01:51
2
answers

CakePHP - Relation 1 ~ n

Good evening, I'm having difficulty in CakePHP 3 and the problem is this:    Can not insert row, some of the primary key values are missing. Got (,), expecting (idstorie, users_iduser) The system should add a "Storie" to the DB, in that...
asked by 30.06.2016 / 04:11