I have performed a stratified sample on a multi-label dataset before training a classifier and want to check how balanced it is now. The columns in the dataset are: |_Body|label_0|label_1|label_10|…
Tag: sql
Retrieve Records of the Last Consecutive Dates in PostgreSQL
Edit Sorry for being unclear in the first post. If the item appears only once, it should also be included. Please, check updated sample table… I have a table of record of sales of each item per day….
Order of the tables in a JOIN
In spark-sql I have a query that uses several tables (both large & small) in Joins. My question is – does the order of these tables matter with respect to query performance ? For e.g. select …
How to set and use variable in a trigger?
I’m creating a trigger in MySQL that should set a variable and use it to update a table. But i can’t find the right syntax to make this work. This is what i tried: CREATE TRIGGER …
Calculation of rank according to supplier table & sales table
I’m working with SQL Server 2014; I attached a purchase table (from suppliers) and sales table. First, I need to use a sales table based on the rankings from the purchase table, product bought first …
Get length of time while status remains the same
I have a history table which looks like this: | ID | DateChanged | Status | |—-|————-|——–| | 1 | 01/01/2019 | Closed | | 1 | 05/01/2019 | Open | | 1 | 10/01/2019 | Open | | 2 …
ERROR: varchar data type to a datetime data type resulted in error out-of-range value
I get this error message when I run the below query. Do you have any idea how I can solve this error? varchar data type to a datetime data type resulted in error out-of-range value I have been …
How can I translate a query from SQL Server to Oracle?
I’m trying to migrate a simple stored procedure from SQL Server to Oracle. I have already tried a few online converters but with no success, such as the Scratch editor. Can anyone help? CREATE …
With MySQL, how to calculate a MEDIAN with Left Join records?
Given the following two tables, I’d like to know how to calculate the MEDIAN rating for reviews on a weekly basis. reviews (id, user_id, completed_at) reviews.completed_at — lets us know the user …
Trying to replace a Cross Apply with a JOIN
We have a table, ProductHierarchy, which is set. The # of rows will not change. It has simple parent/child Product Hierarchy data in it. We also have a Table-valued function which takes a …