relational-database

Relational vs. Dimensional Databases, what's the difference?

I'm trying to learn about OLAP and data warehousing, and I'm confused about the difference between relational and dimensional modeling. Is dimensional modeling basically relational modeling, but allowing for redundant/un-normalized data? For example, let's say I have historical sales data on (product, city, # sales). I understand that t...

Last results submitted in mysql db

How would i get the last 20 results submitted in a mysql db row. I need the 20 most recent user submitted results. Cheers. ...

Still Confused About Identifying vs. Non-Identifying Relationships

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 Relation...

Representing relational database data as XML and using XPath to get results

Hello, we have a relational database with some data and we need to offer the content of the database via XML web services. We also have to enable users to get parts of the XML representation using XPath (also later there may be a need to modify data indirectly using XML representation of the data with XQuery). Is there a simple way to a...

How to force grails GORM to respect DB scheme ?

I have two domains : class CodeSet { String id String owner String comments String geneRLF String systemAPF static hasMany = [cartridges:Cartridge] static constraints = { id(unique:true,blank:false) } static mapping = { table 'code_set' version false columns { id column:'code...

Call more than one item from a different model?

Hi Everyone, At the moment in my application I can select a company from the company model when creating a new kase in the kase model. <ul id="kases_new"> <li>Company<span><%= f.select :company_id, Company.all.collect {|m| [m.companyname, m.id]} %></span></li> This shows a list of the companies and then when I choose one it adds...

Are document-oriented databases meant to replace relational databases?

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 ...

GORM ID generation and belongsTo association ?

I have two domains : class CodeSetDetail { String id String codeSummaryId static hasMany = [codes:CodeSummary] static constraints = { id(unique:true,blank:false) } static mapping = { version false id column:'code_set_detail_id', generator: 'assigned' } } and : class CodeSummary { String i...

Use cases for NoSQL

NoSQL has been getting a lot of attention in the 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 to a NoSQL solution. I'm particularly interested in MongoDB and C...

mysql codeigniter active record m:m deletion

Hi There, I have a table 2 tables that have a m:m relationship, what I can wanting is that when I delete a row from one of the tables I want the row in the joining table to be deleted as well, my sql is as follow, Table 1 CREATE TABLE IF NOT EXISTS `job_feed` ( `id` int(11) NOT NULL AUTO_INCREMENT, `body` text NOT NULL, `dat...

best way to store 1:1 user relationships in relational database

What is the best way to store user relationships, e.g. friendships, that must be bidirectional (you're my friend, thus I'm your friend) in a rel. database, e.g. MYSql? I can think of two ways: Everytime a user friends another user, I'd add two rows to a database, row A consisting of the user id of the innitiating user followed by the...

With modern social networking and scaling, can Cassandra replace the standard relational database such as MySQL?

Is it possible to build the entire social networking application on cassandra? Sure, it takes longer to set up, but it scales much better. Correct? Please list the situations when Cassandra should be used. ...

Writing csv files with python with exact formatting parameters

I'm having trouble with processing some csv data files for a project. Someone suggested using python/csv reader to help break down the files, which I've had some success with, but not in a way I can use. This code is a little different from what I was trying before. I am essentially attempting to create an array. In the raw data fo...

Question about OOP and objects.

I have a school assignment: a Dog Show. My assignment is to create a website, where vistors can display results, and where Judges and Secretary can admin and CRUD. I have a small problem, one part of the assignment: the result should be based on two decisions from different judges, and after that checked by the secretary, before the re...

(Database Design - products attributes): What is better option for product attribute database design?

Hi, I new in database design. What is better option for product attribute database design for cms?(Please suggest other options also). option 1: 1 table products{ id product_name color price attribute_name1 attribute_value1 attribute_name2 attribute_value2 attribute_name3 attribute_value3 } option 2: 3 tables products{ id product_na...

Rating System Database Structure

I have two entity groups. Restaurants and Users. Restaurants can be rated (1-5) by users. And rating fromeach user should be retrievable. Resturant(id, name, ..... , total_number_of_votes, total_voting_points ) User (id, name ...... ) Rating (id, restaurant_id, user_id, rating_value) Do i need to store the avg value so that it need no...

Database design grouping contacts by lists and companies

Hi, I'm wondering what would be the best way to group contacts by their company. Right now a user can group their contacts by custom created lists but I'd like to be able to group contacts by their company as well as store the contact's position (i.e. Project Manager of XYZ company). Database wise this is what I have for grouping cont...

Relational databases are not suited for my application - what's the alternative?

Hi, I'm writing a CMS in PHP that allows the user to define different fields (e.g. a Blog page could have fields for Title (string), Content (rich text), Picture (file)). I need the user to be able to add and remove fields dynamically, and the only way I can think of to do it with relational DBs is to serialise all these values and stor...

Why is it bad to use boolean flags in databases? And what should be used instead?

I've been reading through some of guides on database optimization and best practices and a lot of them suggest not using boolean flags at all in the DB schema (ex http://forge.mysql.com/wiki/Top10SQLPerformanceTips). However, they never provide any reason as to why this is bad. Is it a peformance issue? is it hard to index or query prope...

What are prepared statements?

What are prepared statements in the context of relational databases? How do they help and when should I consider using them? ...