How do I store data pertaining to a month or year in Mysql - mysql

I receive csv files at the end of each month from my customer for each of their KPI (for example csv's for resumes received, candidates joined, candidates resigned, sales, profits, loss , etc) for that specific month.
I want to be able to query this data inorder to generate reports for any month, day or year. This report will be generated dynamically i.e the admin would specify what rows he would like to have in a report (for eg a report with applications received, applications shortlisted, candidates shortlisted after the 1st interview for the period of jan to july.) for any period of time.
What would be the best way to store the data into my database in order to generate such reports? I am using Mysql as my database.
I am not sure if I would need to flush out the old data from my tables currently. So considering that I keep all the data persistent, what would be the best suited database design for this?
Currently what I do is I have a table for each of their KPI. This table has got a date field which I am using to generate the report. But I am looking for a more optimized way.
Thanks in advance.

It is better to store those values (month or year related values ) in a "Date" type fields which would not need any other manipulation while building reports. The conditions or logic for the specific period of time should be handled in your front end. In this case, the usage of Date field is the optimized way.

Related

MySQL: Dates as column headers

I'm trying to develop a new reporting module for a resource management tool (PHP+Mysql).
I am trying to extract data in the following format from mysql:
I have a table that consists of date and location of multiple people(i.e Office, Home or Client).
Sample Data as in DB.
here date_plotted means the date at which the user is engaged and plotting_date represents when this particular entry was made in the system(the date). So User was plotted to be in office on 30th Oct and the same entry was made on 30th Oct.
Data as in resource table
The resource table represents the user table.
Any suggestions on how to do the same in mysql?
These are the primary tables which needs to be used.
The above table id done in excel for now to represent the outcome.
I'm new to SQL so haven't tried anything yet.
There is a tool for Windows that might simplify this operation. It's made by MySQL and called MySQL for Excel. In theory it should allow you to structure and make changes to MySQL databases as well as perform queries that result in spreadsheets.
Without knowing more about your data, for example being supplied an actual csv file to work with, and the parameters of the actual pull, whether it's fix dates always or if this is a dynamic pull based on a range this question could result in 100 different implementations that visually return similar results, but have massively different requirements overhead-wise in implementation.

MS-Access: updating query for each new linked table each week

First - thanks for your time. My issue lies in my new usage of Access for tracking values from weekly excel reports. Each week I'm given a new excel file with updated values for about 50 employees. These values generally track their performance over 6 different metrics. I've begun to link these excels into an access database to keep and track that data each week. These linked tables are given the name convention of the date that the data is as of - example: 05-05; 05-12; 05-19, 05-26; etc.
My question is - is there a way to build a query to track the change (difference in values) from last week to this week (05-19 to 05-26), automatically? And also taking into account future additions of linked tables so that I don't have to add a piece to the query each week?
In addition, I'm looking to track overall change - first table 05-05 to the most recent linked table (which ever date that's true for, whether it's the end of July, or the end of the year).
Based on these 2 results, I'd eventually build out the query to show every week with their value and in the next column the week over week change (up down or neutral)

Merging table data in mysql?

I have an LDAP CSV file that is imported nightly and dumped into my MYSQL database. It has about 70000 employee records.
Included in that is empl#, email, group, supervisor, etc.
I have reports that are being generated from various web sites. We are dumping these reports in the database once a month. These reports usually have empl#, email, hits, logins, whatever...
My goal is to combine the report data and add in things like group, supervisor, etc based on empl#... Speed is a big concern because of the size of the database and number of users.
At first I thought of making a simple left join (given that report data is left - and that all people in the report may not be an employee). However the problem with that is that it does not take a snapshot in time. If report data from 6 months ago is viewed I don't want it mixed with current employee data - I want it to stay a snapshot in time.
What is the best way to handle this?
You will need a date column of some kind in both sets of data on which to join. Once you have that, you can simply put a condition that establishes the snapshot in the WHERE that limits the selection.

Saving reports query to database

I am developing an web app that is reliant on reports being dynamically generated. The client has specified they would like to save reports searches to the database for future use, specifically generating reports from the last 6 month.
I can add the query to the database no bother, the problem is trying to get the date to be dynamic depending on the date the report is ran. The 3 types are bi-monthly, monthly and 6 monthly reports.
My question is:
How would I go about saving the query and getting it to calculate the current date and search based on the report type (2, 3 or 6 month). Is it a simple case of editing the sql query when I pull the query from the database, or would it be easier to split up the query into different parts to make it easier to manipulate/edit later.
Create a second column in your table where you store the query with the dynamic column. Use that column in your dynamic query

How can I have a database table with only one time for each day?

Hi I am developing a Taxreturn Program in Java language and is my first time I am developing a program with database. I have three Forms which means I need three tables in my database where I am going to store information of each form. My first Form is for customers the second is for bookings and the third is for tax records I have successful make the customer form work with the database but i got stuck in the booking form as i need the correct syntax.
in my booking table i need to store the date, time as Is logical I have to have only one booking time for each day how can i do that. I will appreciate any help thanks
It depends on the type of the field.
If field is Date, some implementations assume the time is 00:00:00 ... Many of them simply store the exact timestamp, but truncate and give you the value, as required.
Best way to do it is when inserting, manually specify the exact time yourself. This is the most cross-database way of doing things.