Похожие чаты

How do you create tables that each have a field

that depends on the other? For instance, I have a groups table which has a pinned_message that references the id field on the messages talble, and the messages table which has a field group_id which references the group that the message belongs to.

2 ответов

8 просмотров

Maybe you could create the tables first and then the foreign keys later. Or you could create a separate table for pinned messages, giving it both a group id and message id. And if you want there to be only one pinned message per group, you could give this table a compound primary key made up of both the group id and message id.

Resolve dependencies in the third table. Message shouldn't store group_id.

Похожие вопросы

Обсуждают сегодня

$params = [ 'formid' => 'feedbackForm', 'formTpl' => '@CODE: <form class="form-validate" data-id="ajax_form"> <fieldset class="margin-bottom-md"> ...
Pathologic
1
'frakturBold' => ['𝖆', '𝖇', '𝖈', '𝖉', '𝖊', '𝖋', '𝖌', '𝖍', '𝖎', '𝖏', '𝖐', '𝖑', '𝖒', '𝖓', '𝖔', '𝖕', '𝖖', '𝖗', '𝖘', '𝖙', '𝖚', '𝖛', '𝖜', '𝖝', '𝖞', '𝖟', '𝕬', '𝕭', '𝕮', '𝕯'...
Roma
4
И ещё вопрос: можно ли типа как на дос как-то запариться и с помощью прерываний выводить текст, вместо функции printf ?
НѣкъиⰘижєжєиꙁъвьсєсвѣтьноѣсѣтиѥсть•
34
Ладно, ещё тупого спрошу. Код должен банально вывести значение регистра на консоль, на деле же не выводя ничего, просто оставляя нерабочую консоль (открыта, ничего не написан...
НѣкъиⰘижєжєиꙁъвьсєсвѣтьноѣсѣтиѥсть•
25
How did we have so many dormant scammers in here? Who are these people. It’s been years. We know each other. If you dm me “I’ve been an og” but haven’t said a single word her...
Justin | LGCY |
49
Right? Every new partnership just makes $Fun stronger and more appealing.
Brian
18
Let me insert my "5++" kilocents into how zcash should be positioned (and how it would have been positioned/adopted from day one). You are allowed to believe or not believe in...
eBiker
5
здравствуйте. пытаюсь проверить, содержится ли в десятичном представлении инта некоторая цифра. совершаю: strstr(x, "5") != NULL) получаю ошибку с фото (заведомо неработающий ...
Катя Шевчук🪇
18
привет всем, подскажите, пожалуйста, где в Манагуа оплачивать штраф за overstay? слышала, что в аэропорту и что надо именно в кордобах
Aisuluu
16
Who else is expecting some big news from the team this week?
Trivixx
14
Карта сайта