So I currently have a database with about 100.000 measurement results from 850 unique tests on 20 devices at 4 different temperatures.
Now i want to create 4 tables from my database containing 850 rows (1 for each unique test) and 20 columns containing the result of each of the unique devices at a single temperature.
I have attached a picture to visualize this below.
Anyone know what kind of SQL operation i should be using to get this output?
Related
I have a column- amount.
I need to split this into 5 and show it for the next 5 years.
Example:
If the amount is 1000, I need to split it equally into 5 and show it for the following 5 years.
Like 1000/5 and the answer should be
2018-200, 2019-200, 2020-200, 2021-200, 2022-200.
How can this be done in Mysql?
I am trying to store approximately 11 billion records in the destination table by querying various source tables via inner join.
I would need to store the data based on Year and Quarter. There is a need to store data from year 2000 onward.
So I would have tables for e.g
FinData2015_1
FinData2015_2
FinData2015_3
FinData2015_4
FinData2016_1
FinData2016_2
FinData2016_3
FinData2016_4
I planned to create the physical tables right from year 2000 to 50 years from now and implement a split condition component in SSIS.
So I would create in all 67 tables in all and 67 split conditions
See the screenshot below
Is there a better way to do this. That is creating table dynamically if data for that year and quarter exist
I'm using Microsoft Access 2007 to query two separate SharePoint sources.
The first has most of the data I need. The unique ID number for each row in the first has a corresponding column in the second. The ID from the first can occur multiple times in the second. (It's a mapping between two different databases of defects.)first.
What I want to do is this: find all the ID's from table one that occur in the second, and list ID's from the second for each item that corresponds with the first. For starters, I want something a bit like this:
Table 1 ID Table 2 ID's
5 9, 13, 23
10 11, 15
20 8
But there's also more data from Table 1 I want to display for each item.
What I'm getting is this:
Table 1 ID Table 2 ID Table 1 Data
5 9 Row 5 Additional Data
5 13 Row 5 Additional Data
5 23 Row 5 Additional Data
10 11 Row 10 Additional Data
10 15 Row 10 Additional Data
20 8 Row 20 Additional Data
What I want is something like this:
Table 1 ID Table 2 ID's Table 1 Data
5 9, 13, 23 Row 5 Additional Data
10 11, 15 Row 10 Additional Data
20 8 Row 20 Additional Data
Or perhaps:
Table 1 ID Table 2 ID's
5 9, 13, 23
Row 5 Additional Data
10 11, 15
Row 10 Additional Data
20 8
Row 20 Additional Data
How can I create a report like that?
Comma-separated list from multiple records
Grouping of multiple data rows into a comma-separated list is not a built-in feature of Access. There are various ways to do this, but I most often see links to Allen Browne's tutorial.
Multi-line row details
The difference between your last two examples is just a matter of formatting a Form or Report in Design View. A Report (here capitalized) in Access is a specific type of object for generating custom, formatted views of your data, often for printing or read-only viewing. A Form is a dynamic, on-screen view of your data. I suspect that your use of "report" is of a more general sense.
First of all, there is no way to make multiple lines using the default Datasheet View of tables and queries. To get multiple lines per row of data, you need to create a Form or Report object in Access. In Design View, you can move the data controls around the detail area to produce multiple lines for each data row. I suggest searching for tutorials on the web for creating Access Forms and Reports.
See Guide to designing reports.
I would like help with sql query code to push the consequent data in a specific column down by a row.
For example in a random table like the following,
x column y column
6 6
9 4
89 30
34 15
the results should be "pushed" down a row, meaning
x column y column
6 null or 0 (preferably)
9 6
89 4
34 30
SQL tables have no inherent concept of ordering. Hence, the concept of "next row" does not make sense.
Your example has no column that specifies the order for the rows. There is no definition of next. So, what you want to do cannot be done.
I am not aware of a simple way to do this with the way you are showing the table being formatted. If your perhaps added two consecutively numbered integer fields that provide row number and row number + 1 values, you could join the table to itself and get that information.
After taking a backup of you table:
Make a PHP function that will:
- Load all values of Y into an array
- Set Y = 0 (MYSQL UPDATE)
- load the values back from PHP array to MYSQL
I am maintaining record of expenses an expenses table looks like this
Expenses(id,name)
Expenses_data(id,amount,expense_id)
Expenses are based on years, lets say 10 years and i am saving it as months, so it would 120 months
If i would have 10 expenses then expenses_data would have 120*10 = 1200 Rows
I want to save it from 1200 rows to 120 rows and data would be like this as i enter in excel
id month marketing electricity bank charges
1 month-1 100 200 300
2 month-2 95.5 5000 100
Please suggest if it is possible and how ?
I think you probably what to stick to the database structure you already have, but use a query to display the data in the format you wish.
If you think about the number of data-points you're storing, there's not much difference between your sought schema and what you already have -- it's still 1200 data-points of expenses. Having to upgrade your schema each time you add an expense column would be pretty invasive.
Sticking with a query for your excel export would allow the database to understand the concept of expense categories, and updating your export query to include the new category would be much easier than modifying the schema. The necessary JOINs could even be calculated programmatically by iterating an initial query of "What Expense Categories are known?"