Is it possible that creating a foreign key will open more than 1 connection to the mySQL?

|
dev 2022-01-18 03:56:22
Can you advise me with good tutorials that explain table joints + what should I do with my query to make it right?
piterden 2022-01-18 04:00:35
I don’t know any tutorials. Moreover I cant explain it to you by myself. Don’t know how. There is two ways: you are understand how it works or you are not understand. I understood how should DB looks like long time before I wrote my first line of code. And I never used any kind of tutorials for that
dev 2022-01-18 04:03:44
dev 2022-01-18 03:14:55
I wrote this query and when I execute it, doesn’t insert anything to the attend table:
$q = INSERT INTO attend SELECT id, fullName, number, ‘absent’, ‘curdate()’
FROM student
WHERE id NOT IN (SELECT stu_id FROM attend WHERE day_date = ‘curdate()’)”;

curdate = the current date because I inserted date with current date and system will take the attendant once every day.

Okay can you tell me what is wrong with this query

piterden 2022-01-18 04:07:46
Structure of tables is incorrect.
piterden 2022-01-18 04:08:22
Try to read how it works and look at how it done by other people
piterden 2022-01-18 04:09:14
But it is better to ask someone who can do it and can speak your language
dev 2022-01-18 04:10:10
piterden 2022-01-18 04:08:22
Try to read how it works and look at how it done by other people

OK thank you

Saikumar K 2022-01-18 09:12:04
Which tool is best for query analysis for mysql
Liran 2022-01-18 11:48:11
is it possible that creating a foreign key will open more than 1 connection to the mySQL?
MasterZiv 2022-01-18 11:50:39
Liran 2022-01-18 11:48:11
is it possible that creating a foreign key will open more than 1 connection to the mySQL?

no

MasterZiv 2022-01-18 11:50:55
Saikumar K 2022-01-18 09:12:04
Which tool is best for query analysis for mysql

human brain

cris_highlight_bot 2022-01-18 12:07:13
Liran 2022-01-18 12:07:13
even when using migration library like phinx (php)?

$table = $this->table(‘tb_suppliers’);
$table->addColumn(‘chain_id’,’integer’,[‘null’ => true]);
$table->addForeignKey(‘chain_id’, ‘tb_chains’, ‘id’, array(‘update’ => ‘NO_ACTION’, ‘delete’ => ‘NO_ACTION’))
->update();

this is the code we run

mysql_en-16151.jpg

Liran 2022-01-18 12:07:13
MasterZiv 2022-01-18 11:50:39
no

even when using migration library like phinx (php)?

$table = $this->table(‘tb_suppliers’);
$table->addColumn(‘chain_id’,’integer’,[‘null’ => true]);
$table->addForeignKey(‘chain_id’, ‘tb_chains’, ‘id’, array(‘update’ => ‘NO_ACTION’, ‘delete’ => ‘NO_ACTION’))
->update();

this is the code we run

MasterZiv 2022-01-18 12:08:14
Liran 2022-01-18 12:07:13
even when using migration library like phinx (php)?

$table = $this->table(‘tb_suppliers’);
$table->addColumn(‘chain_id’,’integer’,[‘null’ => true]);
$table->addForeignKey(‘chain_id’, ‘tb_chains’, ‘id’, array(‘update’ => ‘NO_ACTION’, ‘delete’ => ‘NO_ACTION’))
->update();

this is the code we run

php can do anything.

Liran 2022-01-18 12:59:34
[Note] Aborted connection 288429991 to db: ‘grouponi_groupon’ user: ‘groupon_inmanage’ host: ‘8.8.8.8.8’ (Got an error reading communication packets)
what does this error means? 🙁 i have plenty of those
MasterZiv 2022-01-18 13:17:24
Liran 2022-01-18 12:59:34
[Note] Aborted connection 288429991 to db: ‘grouponi_groupon’ user: ‘groupon_inmanage’ host: ‘8.8.8.8.8’ (Got an error reading communication packets)
what does this error means? 🙁 i have plenty of those

those are network problems

Liran 2022-01-18 13:33:24
MasterZiv 2022-01-18 13:17:24
those are network problems

what can cause such problems? is it like connections that are not closed properly?

MasterZiv 2022-01-18 13:33:38
Liran 2022-01-18 13:33:24
what can cause such problems? is it like connections that are not closed properly?

bad or misconfigured network

Liran 2022-01-18 13:41:02
MasterZiv 2022-01-18 13:33:38
bad or misconfigured network

Max connection counts also the aborted connections? is it possible?

MasterZiv 2022-01-18 13:45:20
Liran 2022-01-18 13:41:02
Max connection counts also the aborted connections? is it possible?

no this is network

Liran 2022-01-18 13:45:46
MasterZiv 2022-01-18 13:45:20
no this is network

what do you mean?

MasterZiv 2022-01-18 13:46:04
Liran 2022-01-18 13:45:46
what do you mean?

This is a network error

MasterZiv 2022-01-18 13:46:18
Liran 2022-01-18 12:59:34
[Note] Aborted connection 288429991 to db: ‘grouponi_groupon’ user: ‘groupon_inmanage’ host: ‘8.8.8.8.8’ (Got an error reading communication packets)
what does this error means? 🙁 i have plenty of those

This is network error

MasterZiv 2022-01-18 13:46:52
Liran 2022-01-18 12:59:34
[Note] Aborted connection 288429991 to db: ‘grouponi_groupon’ user: ‘groupon_inmanage’ host: ‘8.8.8.8.8’ (Got an error reading communication packets)
what does this error means? 🙁 i have plenty of those

I mean this is a network error caused by network doesn’t work

Liran 2022-01-18 13:47:15
MasterZiv 2022-01-18 13:46:52
I mean this is a network error caused by network doesn’t work

like mysql is down so I get this error?

Var 2022-01-18 13:47:17
Hi Guys,I want update time whenver update existing column.please
MasterZiv 2022-01-18 13:47:58
Liran 2022-01-18 13:47:15
like mysql is down so I get this error?

No, like MySQL is working but network can’t deliver the packets server sends

Liran 2022-01-18 13:48:40
MasterZiv 2022-01-18 13:47:58
No, like MySQL is working but network can’t deliver the packets server sends

can be caused because mySQL was running many queries in the same time?

MasterZiv 2022-01-18 13:49:33
I’m tired.
svart 2022-01-18 14:24:29
Var 2022-01-18 13:47:17
Hi Guys,I want update time whenver update existing column.please

use a trigger or “on update current_timestamp” condition for a column

Liran 2022-01-18 15:35:27
can drop column lock a table?
MasterZiv 2022-01-18 15:45:04
Liran 2022-01-18 15:35:27
can drop column lock a table?

Yes, it must lock

Liran 2022-01-18 15:57:55
MasterZiv 2022-01-18 15:45:04
Yes, it must lock

what if I use LOCK=NONE;?

svart 2022-01-18 15:58:45
what if you read documentation and stop asking here every question which pops up
MasterZiv 2022-01-18 15:59:43
Liran 2022-01-18 15:57:55
what if I use LOCK=NONE;?

read the docs, but in general, schema can’t be changed without locks, even maybe logical locks

|