relational-database

Still Confused About Identifying vs. Non-Identifying Relationships

感情迁移 提交于 2019-11-26 10:07:30
问题 So, I\'ve been reading up on identifying vs. non-identifying relationships in my database design, and a number of the answers on SO seem contradicting to me. Here are the two questions I am looking at: What\'s the Difference Between Identifying and Non-Identifying Relationships Trouble Deciding on Identifying or Non-Identifying Relationship Looking at the top answers from each question, I appear to get two different ideas of what an identifying relationship is. The first question\'s response

Use cases for NoSQL [closed]

寵の児 提交于 2019-11-26 10:06:26
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . NoSQL has been getting a lot of attention in our industry recently. I\'m really interested in what peoples thoughts are on the best use-cases for its use over relational database storage. What should trigger a developer into thinking that particular datasets are more suited

Why use multiple columns as primary keys (composite primary key)

做~自己de王妃 提交于 2019-11-26 09:16:17
问题 This example is taken from w3schools. CREATE TABLE Persons ( P_Id int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255), CONSTRAINT pk_PersonID PRIMARY KEY (P_Id,LastName) ) My understanding is that both columns together ( P_Id and LastName ) represent a primary key for the table Persons . Is this correct? Why would someone want to use multiple columns as primary keys instead of a single column? How many columns can be used together as a

Storing time-series data, relational or non?

泄露秘密 提交于 2019-11-26 08:38:58
问题 I am creating a system which polls devices for data on varying metrics such as CPU utilisation, disk utilisation, temperature etc. at (probably) 5 minute intervals using SNMP. The ultimate goal is to provide visualisations to a user of the system in the form of time-series graphs. I have looked at using RRDTool in the past, but rejected it as storing the captured data indefinitely is important to my project, and I want higher level and more flexible access to the captured data. So my question

Database schema which can support specialized properties

不羁岁月 提交于 2019-11-26 08:09:52
问题 I need to store a set of entities, of which there are several specialized versions. They have some common properties, but the specialized ones contain properties specific for that entity. Solutions The data store is a relational DBMS, and this is not for discussion :-) Specifically, it is the Microsoft SQL Server 2005. I could easily create a table for the common properties and then a table for each of the specialized versions. However, it is likely that new entities will have to be added to

How can I find MAX with relational algebra?

巧了我就是萌 提交于 2019-11-26 07:21:31
问题 Working with databases, how can I find MAX using relational algebra? 回答1: Assuming you have a relation, A, with a single attribute, 'a' (reducing a more complex relation to this is a simple task in relational algebra, I'm sure you got this far), so now you want to find the maximum value in A. One way to do it is to find the cross product of A with itself, be sure to rename 'a' so your new relation has attributes with distinct names. for example: (rename 'a' as 'a1') X (rename 'a' as 'a2') now

Difference between 3NF and BCNF in simple terms (must be able to explain to an 8-year old)

坚强是说给别人听的谎言 提交于 2019-11-26 06:52:58
问题 I have read the quote : data depends on the key [1NF], the whole key [2NF] and nothing but the key [3NF] . However, I am having trouble understanding 3.5NF or BCNF as it\'s called. Here is what I understand : BCNF is stricter than 3NF left side of any FD in the table must be a superkey (or at least a candidate key) So why is it then, that some 3NF tables are not in BCNF? I mean, the 3NF quote explicitly says \"nothing but the key\" meaning that all attributes depend solely on the primary key.

How to create relationships in MySQL

99封情书 提交于 2019-11-26 06:15:39
问题 In class, we are all \'studying\' databases, and everyone is using Access. Bored with this, I am trying to do what the rest of the class is doing, but with raw SQL commands with MySQL instead of using Access. I have managed to create databases and tables, but now how do I make a relationship between two tables? If I have my two tables like this: CREATE TABLE accounts( account_id INT NOT NULL AUTO_INCREMENT, customer_id INT( 4 ) NOT NULL , account_type ENUM( \'savings\', \'credit\' ) NOT NULL,

Relational database design multiple user types

为君一笑 提交于 2019-11-26 05:36:09
问题 I have a 4 types of users and each have specific data, but they also share commun data, like username , password .. My first thought is to create a main users table with user_type column. Then when querying user data i can just first select their user_type and then depending on the output run a different query to grab \"user type\" specific data. I am not fond of this as i wish i could grab all user related data with one query and ideally using Foreign Keys. Second idea is to not have a user

What is the best design for a database table that can be owned by two different resources, and therefore needs two different foreign keys?

别等时光非礼了梦想. 提交于 2019-11-26 05:23:58
My application has notification settings for users that can belong to groups. A group administrator can define settings for the entire group, so that when any user performs an action, the administrator is notified. The administrator can also define settings for an individual user, which will override the group setting. Right now I have a database with columns: group_id, action1, action2, action3, ... . The actions are booleans that determine if the administrator is notified when that action is performed by a user in his or her group. I could make a separate table owned by the User model