Data Analysis with MongoDB or MySQL in Grails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Data Analysis with MongoDB or MySQL in Grails

manhooei
I have a need for processing some data in order to come up with some statistic. This is the scenario:

Each user can answer several questions from the question list. They pick their answers from a drop-down list, therefore the answer is predictable in terms of format.

Some users answer more or less than others

I would like to choose a specific user, and run a query on his answers. For example: I want to know how many other users answered the same questions as my user and their answers where the same. If my user answered "his name is 25", "his gender is male", and "his height is 6" then how many users are in the database that have their age as 25, their gender male, and their height as 6 ?

Maybe user x answered 5 questions, but as long as his 3 questions and answers match with my user's 3 questions and answers it's a hit. I want to discards users who answered anything less than what my user answered which means user who answered 2 questions are discarded.

Can MySQL achieve such query without cause heavy performance hits ? And if yes how can I construct such query ? Here is some basic tables I created to communicate the concept better.

CREATE TABLE Question (
  QID INT,
  QTxt VARCHAR(150),
  QOrder INT);

CREATE TABLE User (
  UID INT,
  UserName VARCHAR(150));

CREATE TABLE ANSWER (
  AID INT,
  ATxt VARCHAR(150),  
  QID INT,
  USERID INT);
Reply | Threaded
Open this post in threaded view
|

Re: Data Analysis with MongoDB or MySQL in Grails

bdrhoa

You can definitely do what you want with SQL. I assume so with mongols.  But you want to look at the basics of Grails. Create your domain objects and the underlying db is created for you.

On Nov 21, 2013 12:21 PM, "manhooei" <[hidden email]> wrote:
I have a need for processing some data in order to come up with some
statistic. This is the scenario:

Each user can answer several questions from the question list. They pick
their answers from a drop-down list, therefore the answer is predictable in
terms of format.

Some users answer more or less than others

I would like to choose a specific user, and run a query on his answers. For
example: I want to know how many other users answered the same questions as
my user and their answers where the same. If my user answered "his name is
25", "his gender is male", and "his height is 6" then how many users are in
the database that have their age as 25, their gender male, and their height
as 6 ?

Maybe user x answered 5 questions, but as long as his 3 questions and
answers match with my user's 3 questions and answers it's a hit. I want to
discards users who answered anything less than what my user answered which
means user who answered 2 questions are discarded.

Can MySQL achieve such query without cause heavy performance hits ? And if
yes how can I construct such query ? Here is some basic tables I created to
communicate the concept better.

CREATE TABLE Question (
  QID INT,
  QTxt VARCHAR(150),
  QOrder INT);

CREATE TABLE User (
  UID INT,
  UserName VARCHAR(150));

CREATE TABLE ANSWER (
  AID INT,
  ATxt VARCHAR(150),
  QID INT,
  USERID INT);



--
View this message in context: http://grails.1312388.n4.nabble.com/Data-Analysis-with-MongoDB-or-MySQL-in-Grails-tp4651696.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Data Analysis with MongoDB or MySQL in Grails

manhooei
Thanks, But is there a suggestion on how to construct the query ? I tried many different ones and it just doesn't give me the result I want.
Reply | Threaded
Open this post in threaded view
|

Re: Data Analysis with MongoDB or MySQL in Grails

bdrhoa
Post your Grails code. On rare occasions, it's necessary to fall back to raw SQL. But in any case, ask more specific questions, showing what you've tried, what your results are, etc.

---------------------------
www.maf.org/rhoads
www.ontherhoads.org


On Fri, Nov 22, 2013 at 7:47 AM, manhooei <[hidden email]> wrote:
Thanks, But is there a suggestion on how to construct the query ? I tried
many different ones and it just doesn't give me the result I want.



--
View this message in context: http://grails.1312388.n4.nabble.com/Data-Analysis-with-MongoDB-or-MySQL-in-Grails-tp4651696p4651731.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email