relational-database

Ruby on Rails: Saving multiple values in a single database cell

允我心安 提交于 2019-12-03 20:16:24
How do I save multiple values in a single cell record in Ruby on Rails applications? If I have a table named Exp with columns named: Education , Experience , and Skill , what is the best practice if I want users to store multiple values such as: education institutions or skills in a single row? I'd like to have users use multiple text fields, but should go into same cell record. For instance if user has multiple skills, those skills should be in one cell? Would this be best or would it be better if I created a new table for just skills? Please advise, Thanks I would not recommend storing

Are document-oriented databases meant to replace relational databases?

谁说胖子不能爱 提交于 2019-12-03 17:54:05
问题 Recently I've been working a little with MongoDB and I have to say I really like it. However it is a completely different type of database then I am used. I've noticed that it is most definitely better for certain types of data, however for heavily normalized databases it might not be the best choice. It appears to me however that it can completely take the place of just about any relational database you may have and in most cases perform better, which is mind boggling. This leads me to ask a

Using a Filesystem (Not a Database!) for Schemaless Data - Best Practices

浪子不回头ぞ 提交于 2019-12-03 10:48:12
问题 After reading over my other question, Using a Relational Database for Schema-Less Data, I began to wonder if a filesystem is more appropriate than a relational database for storing and querying schemaless data. Rather than just building a file system on top of MySQL, why not just save the data directly to the filesystem? Indexing needs to be figured out, but modern filesystems are very stable, have great features like replication, snapshot and backup facilities, and are flexible at storing

Clear explanation of the “theta join” in relational algebra?

半城伤御伤魂 提交于 2019-12-03 09:28:59
问题 I'm looking for a clear, basic explanation of the concept of theta join in relational algebra and perhaps an example (using SQL perhaps) to illustrate its usage. If I understand it correctly, the theta join is a natural join with a condition added in. So, whereas the natural join enforces equality between attributes of the same name (and removes the duplicate?), the theta join does the same thing but adds in a condition. Do I have this right? Any clear explanation, in simple terms (for a non

Removing Mirrored Pairs from SQL Join

北城以北 提交于 2019-12-03 09:23:19
I have a table with 2 fields (name, interest) and I want to find all pairs that have the same interest, with all duplicates and mirrored pairs removed. I am able to find all pairs and remove duplicates with the following SQL statement: SELECT P1.name AS name1, P2.name AS name2, P1.interest FROM Table AS P1, Table AS P2 WHERE P1.interest = P2.interest AND P1.name <> P2.name; But I am not sure how to remove mirrored pairs, ie: "wil","ben","databases" "ben","wil","databases" I tried to make the above statement a view called Matches and attempted the following query: SELECT * FROM Matches WHERE

Why are relational databases having scalability issues?

送分小仙女□ 提交于 2019-12-03 08:19:48
问题 Recenctly I read some articles online that indicates relational databases have scaling issues and not good to use when it comes to big data. Specially in cloud computing where the data is big. But I could not find good solid reasons to why it isn't scalable much, by googling. Can you please explain me the limitations of relational databases when it comes to scalability? Thanks. 回答1: Relational databases provide solid, mature services according to the ACID properties. We get transaction

Difference between super key and composite key

怎甘沉沦 提交于 2019-12-03 07:59:12
I need to understand the difference between super key and composite key. The examples I found made more confused. Can you please simply clarify what is the difference? Thanks A super key uniquely identifies a row. It could be made up of one column or many. A composite key is a key made of more than one column. If a Super Key is made of more than one column it is also a composite. If a composite key uniquely identifies a row it is also a Super key. I don't see the name 'Super key' used too much: it's usually just called a 'Unique key'. The accepted answer is not entirely accurate... A superkey

How to implement Twitter retweet action in my database

余生颓废 提交于 2019-12-03 07:46:41
I am implementing web application similar to Twitter. I need to implement 'retweet' action, and one tweet can by retweeted by one person multiple times . I have a basic 'tweets' table that have columns for: Tweets: tweet_id | tweet_text | tweet_date_created | tweet_user_id (where tweet_id is primary key for tweets, tweet_text contains tweet text, tweet_date_created is the DateTime when tweet was created and tweet_user_id is the foreign key to users table and identifies user who has created the tweet) Now I am wondering how should I implement the retweet action in my database. Option 1 Should I

How would one represent scheduled events in an RDBMS?

微笑、不失礼 提交于 2019-12-03 07:41:14
I have to store scheduled events, (like say class times, for example) that can be organized on a weekly, daily or monthly basis. Events can occur, say, every Monday and Wednesday, or every second Thursday of the month. Is there a way to store this information in an RDBMS that adheres to 3NF? EDIT: This is not homework; I'm building something with a friend for our own edification and we want it in 3NF. To be specific, I'm trying to store the schedules for mass and confession times at RC parishes. These can be scheduled in a hell of a lot of ways, such as every Sunday at x time or every Tue/Thu

Database Structure involving dynamic fields

情到浓时终转凉″ 提交于 2019-12-03 07:40:00
问题 Im working on a project. Its mostly for learning purposes, i find actually trying a complicated project is the best way to learn a language after grasping the basics. Database design is not a strong point, i started reading up on it but its early days and im still learning. Here is my alpha schema, im really at the point where im just trying to jot down everything i can think of and seeing if any issues jump out. http://diagrams.seaquail.net/Diagram.aspx?ID=10094# Some of my concerns i would