relational-database

Group dependency SQL design

空扰寡人 提交于 2021-02-08 10:12:46
问题 I have an entity which has NOT NULL requirements based on the group it belongs to. For instance... There are three types of churches: Buddhist, Muslim, and Christian. All churches have some common required properties, however, each type of church has additional required properties. All people have some common required properties, however, they have additional required properties based on the church type they belong to. People must belong to one and only one church, however, may change their

Group dependency SQL design

空扰寡人 提交于 2021-02-08 10:10:10
问题 I have an entity which has NOT NULL requirements based on the group it belongs to. For instance... There are three types of churches: Buddhist, Muslim, and Christian. All churches have some common required properties, however, each type of church has additional required properties. All people have some common required properties, however, they have additional required properties based on the church type they belong to. People must belong to one and only one church, however, may change their

Postgresql - Determining what records are removed from a cascading delete

爱⌒轻易说出口 提交于 2021-02-08 04:01:37
问题 I have a fairly large postgreql database that I've inherited. We have a job that runs ~monthly that backs up the existing database and creates a new database with updated vendor data that we receive. Currently there is a small issue with it. Without going into details of the table setup, what the data is modeling, etc, I believe it can be fixed with a simple delete query, as the tables are set-up to use cascading deletes. However, it takes about 9 hours to generate this database from the

Postgresql - Determining what records are removed from a cascading delete

爷,独闯天下 提交于 2021-02-08 04:00:52
问题 I have a fairly large postgreql database that I've inherited. We have a job that runs ~monthly that backs up the existing database and creates a new database with updated vendor data that we receive. Currently there is a small issue with it. Without going into details of the table setup, what the data is modeling, etc, I believe it can be fixed with a simple delete query, as the tables are set-up to use cascading deletes. However, it takes about 9 hours to generate this database from the

maximum and minimum number of tuples in natural join

ⅰ亾dé卋堺 提交于 2021-02-02 09:17:55
问题 I came across a question that states Consider the following relation schema pertaining to a students database: Student ( rollno , name, address) Enroll ( rollno, courseno , coursename) where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where '*' denotes natural join ? I have seen several solutions on Internet like this or this

maximum and minimum number of tuples in natural join

偶尔善良 提交于 2021-02-02 09:17:24
问题 I came across a question that states Consider the following relation schema pertaining to a students database: Student ( rollno , name, address) Enroll ( rollno, courseno , coursename) where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where '*' denotes natural join ? I have seen several solutions on Internet like this or this

maximum and minimum number of tuples in natural join

若如初见. 提交于 2021-02-02 09:16:46
问题 I came across a question that states Consider the following relation schema pertaining to a students database: Student ( rollno , name, address) Enroll ( rollno, courseno , coursename) where the primary keys are shown underlined. The number of tuples in the Student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where '*' denotes natural join ? I have seen several solutions on Internet like this or this

Database messaging for multiple model types - user, group, global

橙三吉。 提交于 2021-01-29 15:04:14
问题 I want to implement an alert messaging system, in a website, that will show a message to either multiple users , multiple groups (different DB representation), or globally to all users. What would a good database relationship for this behavior look like? 回答1: This is where I would start based on the information you've given... A table for the alert messages to be sent out... alerts id unsigned int(P) message text +----+---------------------+ | id | message | +----+---------------------+ | 1 |

How does one get properties from related table as properties of it's own table in Laravel 5?

微笑、不失礼 提交于 2021-01-29 02:06:21
问题 The question might sound a little bit confusing but I don't know how to explain it better in one sentence. This describes basically what the problem is: I have a Users table which can contain 2 types of users. I know how I can separate by role. But here's the thing, users with role 1(editor_in_chief) have different attributes than users with role 2(reviewer). My idea was to create a table named 'reviewer_attributes' and 'editor_in_chief_attributes' and create a one-to-one relation with this

Which database structure to choose? [closed]

一曲冷凌霜 提交于 2021-01-27 12:52:04
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I want to implement a notification system. I have users and each user has notification setting Structure 1: Users Notification_settings Notifications -id (pk) -id -id (pk) -username -user_id (fk) references Users