Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

comparison b/w 2 files

 
Sama Mushtaq
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i compare two parameters of multiple files in mysql and chart the results to a graph.what is the query for that?
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the connection between files and MySQL? What are those "parameters"? What should the output of the comparison be - can you give an example? And how should it be graphed?
 
Sama Mushtaq
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the files are .csv files whose values are loaded in the db..there are many types of files that have common columns in the db..i have to graph using JFreeChart..
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so the file contents are in the DB; presumably in a varchar field?

What kind of graph do you have in mind? How would it show differences between the files?

JFreeChart is probably a bad choice; it's mostly geared towards numerical or date/time data.
 
Sama Mushtaq
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually its all numerical data values hence JFreeChart..i am trying to plot thge data as a line graph across the XYaxis,,so basically i will have to end up summing all the data for a date range range and then display it..
 
Sama Mushtaq
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for eg i have to plot a line graph for a specific parameter..i need a query that will extract all the data values in the specific given date range and add the various values pertaining to a specific date..
eg:date range= 04/01/2012--04/30/2012
there are multiple entries for the each date..
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You still haven't said how the file contents are stored in the DB. I assumed the file contents were unstructured in a varchar field; if that's the case, then it would be extremely cumbersome to extract specific data points via SQL. The solution would be to load them into memory, and then to use one of the numerous freely available CSV libraries to obtain an in-memory representation of the CSV.
 
Sama Mushtaq
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its a 1:1 mapping to the .csv file ..all the columns that are present in the file are fields in the db so if the value is a int in the file its will have an int type field in the db..
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you need a way to retrieve all the values that originate in one file, and all the values that originate from the other file, and then check for "differences", however those are defined. What constitutes a "difference" - two values not being exactly identical? If so, what should be plotted on the graph? Remember, we have no idea how your data is structured.
 
Sama Mushtaq
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually there are multiple entries for a date , i need a way to sum all the entries so that for a specific date there is just one number..
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sama, You need to learn something called Structured Query Language (SQL). You can use SQL to retreive data from MYSQL and can also ask MYSQL to aggregate data for you. For example, you need to use a SQL statement like this




I suggest that you pick up a good book on SQL
 
Sama Mushtaq
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@jayesh thanks..will do..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic