I have a table which holds daily metrics : |DateID | Metric1 | Metric2| 20190501 24 34 20190502 25 56 ….. …. …. The table has more than 150 million rows. …
In SQL how to calculate days in a year based on a start date and the number of days lapsed
What would be the SQL to calculate the number of days in each year if I had a start date and the number of days that have lapsed? For example, the date (ymd) 2013-01-01 and the days lapsed is 1000. …
How to insert a random integer number, for a given column and several rows
I was wondering.. Is it possible, with a SQL query, to: generate randomly, a list of integer number insert this in a table, for a specific column, and for multiple rows I didn’t try anything, to be …
How to build an index that is best for this SQL?
I’m querying database by a simple SQL like: SELECT DISTINCT label FROM Document WHERE folderId=123 I need a best index for it. There are two way to implement this. (1) create two indexes CREATE …
Get the ID of the column being read in SqlDataReader
I’m currently reading from an ancient stored procedure. I know you can get the FieldType and FieldCount to get type/size of the columns but is there a way to get the actual ID of the column to read …
Create sql pivot on more row&column
I have to combine in PIVOT multiple columns / rows. let me explain with an example: My start table: PriceListId | ItemId | Stock | PriceIT | PriceES | PriceAT | OriginPriceListId 28 | 25760 | 51 | …
What is wrong with this running total (cumulative column) in Oracle select with a window function?
I have a query containing 0 or 1 in a column. For demonstration purposes I replaced the 1 with 77 so its more easy to see: select dates.d the_date , case TO_CHAR(dates.d, ‘d’) when ‘7’ then 0 when ‘1’…
Navicat SQL Consol in table, set record=itself/10
UPDATE `kingdom`.`monsterinfos` SET `PlusCps` = `PlusCps`/10 on table monsterinfos how to set all pluscps records to itself/10 on navicat console.
Migration MYSQL to ORACLE
right now am working on database migration from MYSQL TO ORACLE. I have experience in MySQL but not in Oracle, So help me to convert the following MYSQL query to ORACLE Mysql query: SELECT MIN(id) …
Optimizing SQL query from derived table
I have the following SQL query select s.channel_id, count(1) as unique_views from ( select m.channel_id from view_statistics vs inner join medias m on m.id = vs.media_id group by m….