Maria DB how to format my sql statement to pull data from my table(s) into cells based on values in column and keywords in rows - formatting

Been a minute since I did SQL programming. I have a large table that can be broken up into several tables.
What I need is where date and keyword row, put the "integer" in the cell. So I have the different years (not sequential, like 1950, 1956, 1958, 1961 ...) going across the top, keywords defining the rows and the integer in the cells.
And what is the best way to sort the columns in date order oldest to the newest. Different quantities of dates for each report.
Thanks

Related

Consolidate Overlapping Ranges in Oracle Sql query

I'm looking to solve using SQL query that would consolidate the ranges between records based on a common Category (Event_Name), the requirement is to have the query process all records, and the result is a unique representation of the data set having fewer records and unique ranges.
Before
After

Clear a particular column of data table in vb

I have a data table which has 3 columns . I am populating the values of each column separately in a loop which causes the table structure to be in the format as shown in the image. How to clear every column at the beginning of the loop so that all data comes in a proper tabular format. In short I want to have a data table with variable number of rows possible for each column.
To clear every column at beginning of the loop you have two options:
loop all rows
remove column, add column
Depending on the plenty of rows the two options have different performances.
For large amount of rows i prefer the second option.

transpose in SQL

Can I transpose results in SQL just like I have it in excel. No hard coded values as I have different results every time.
For example, I have a table of employees and I want it to just convert rows into columns and columns into rows.
Thank you.

String Grouping from a single column in Oracle database having million rows and removing duplicates

We have a huge table and one of the column contains queries like e.g. in row 1
1. (((firstname:Adam OR firstname:Neil ) AND lastname:Lee) ) AND category:"Legal" AND type:Individual
and in row 2 of same column
2. (((firstname:Adam* OR firstname:Neil ) AND lastname:Lee) ) AND category:"Legal" AND type:Organization
Similarly there are few other types of Query strings which are used eventually to query external services.
Issue is based on certain criteria I have to group and remove duplicates from this table.
There are few rules to determine grouping of Strings in different rows.One of them is that if first name and lastname are same then ignore category and type values, therefore above two rows will be grouped to one. There are around million rows. Comparing Strings and doing grouping is not looking elegant solution. What could be best possible solution using sql.

SQL isset and not showing blank 'cells'

I'm using one of my MySQL database tables as an actual table, with times of the day as each column, and one column called day. You guessed it, in day it says the day of the week, and in the rest of the cells it says what is happening at that time.
What I want to do is only show the cells that have value in it. In my case, I'm always going to have all the rows and 2 columns full. The 2 columns are 'day' and '19:00', however in the future I might add values for '18:00' etc.
So, how can I only SELECT the columns and rows which have data in them? Some type of 'WHERE: there is data'?
Thanks!
EDIT: Picture
Having time or day as columns means that you have data in your field names. Data belongs inside the table, so you should normalise the database:
table Calendar
--------------
Day
TimeOfDay
Appointment
This way you don't get a lot of empty fields in the table, and you don't have to change the database design to add another time of day.
Now you can easily fetch only the times that exist:
select Day, TimeOfDay, Appointment from Calendar
From what I gathere you are looking something along the lines of
WHERE col1 IS NOT NULL
But it would be helpful if you could elaborate more on your schema, especially if you could draw a sample table.