What are pros and cons whether I use Order by expression like this: or in this way: How each one does impact on performance? Answer The concatenation is unnecessary and may produce incorrect results. For instance, consider these values: The concatenation will put the first row first. By individual keys, it wi…
Snowflake BIT datatype
i have BIT data type in sql server and i am trying to migrate it to snowflake but i am not able get the data into snowflake properly 0 goes as 0 but 1 goes into as 255 when i DT_UI1 data type to output the column in sql server can anybody help me how to send bit data type
Get comments per video and total sum of comments per video channel
In addition to Get total sum of video comments for each video I noticed that I can’t use v.commentCount because I cleaned some data and now the column is inaccurate. So I need to count the videoId comments and the total videoID comments with the comment table. I have a table video and a table comments. …
How to check if a varchar contains an upper case char in postgreSQL?
I have another Question comming up, while solving some problems with postgreSQL. Is there any option, to check (in a check statement), if a varchar() contains an upper case character? (I want that my table only holds Strings with at least one upper case letter.) Thats how my table look: Does anyone have a tip…
Moving Data from SQL Server to Excel, Views or Query?
I have an Excel spreadsheet that pulls data from a view (that’s pulling from another view) in SQL Server, this was created by someone other than myself. Due to recent changes in how we are storing data in SQL Server, the views no longer actively reflect the data needed. The current Excel spreadsheet use…
How to set flag value based on data that use one-hot-encoding
I have a database consisting of three tables like this: I want to make a machine learning model in R using that database, and the data I need is like this: I can use one hot encoding to convert categorical variable from t_pengolahan (such as “Pengupasan, Fermentasi, etc”) into attributes. But, how…
How to add parameters to a query when query is unknown length
I am working on a project where multiple rows are needed to be added to a MySQL table, due to the high latency of the connection I am trying to add all the values in one command to save time. So far I have a SQL query that is determined by a string array(each string being a “token”), this, being
Does PLSQL in DB2 support nested while statemnts?
I have a following query for DB2 database: BEGIN DECLARE NUMBER_OF_ROWS INT; DECLARE ITER_INDX_1 INT; DECLARE ITER_INDX_2 INT; SET ITER_INDX_1 = 0; SET …
SQL: Update every entry with value from another entry that share same column value
I have the following table trn_ReceiptLog I am wondering if it’s possible to update amount of entry #1 to have same as entry #2 IF amount of entry #1 is 0? I have over 5000 of these entries that …
Joining two rows into one rows (different column) in oracle
I have table with values like this ID |Name |Balance |Type |ProductName 1 Abdol 10000 1 RAID100 2 HIVE 5000000 2 RAID100 3 Ade 20000 …