I have table ‘Areas’ containing customer’s areas: ID, AREA_NAME, PARENT_ID Areas are organized in hierarchy up to four levels using PARENT_ID pointing to parent’s AREA_ID. PARENT_ID for top level …
Best way to create a table with each possible combination of product options and variations
I need to implement in PostgreSQL a table for each combination of option and variation. This is my existing tables: Imagine this scenario: Product: T-Shirt Options: Size, Color Variations: Size:…
Hive – How to read a column from a table which is of type list
I have a Hive table named customer, which has a column named cust_id of list type, with following values: cust_id Now I want to read only this specific column cust_id in my select query, which can give all these list values as following separate values of this column cust_id: Basically I want to fetch all the…
Does ALTER SCHEMA NAME affect permission grants to the schema in Redshift
If i update a schema which has been set up with a bunch of permissions to access other schemas with different access rights, will updating the name undo those grants or will they remain in place? Redshift lists the following on their docs as the syntax to run an alter schema, but does not write if the grants …
How to calculate AVG, MIN & MAX of date interval of a column in a table?
I have a table more like this +—-+————-+———————+ | id | order_id | transaction_date | +—-+————-+———————+ | 1 | TEST000001 | 2018-01-01 00:00:10 | | 2 | TEST000002 | 2…
Full Text Search on MySQL : Can not search by word after hyphen/dash
I have the following record in DB: ‘Vinyl Exam – CA Only’ So, when I performed the following search: Record is returned, but in this case: Item is not returned. What I should do to return the item in the last case. Answer The reason your search isn’t working is because by default, ther…
Multiple queries in the same view
I would like to run multiple queries then show results in a page such as : https://adminlte.io/themes/v3/index.html I create a first controller query : package controllers; import models.Sysuser; …
Rolling 12 month filter criteria in SQL
Having an issue in SQL script where I’m trying to achieve filter criteria of rolling 12 months in the day column which stored data as a text in server. Goal is to count sizes for product at retail store location over the last 12 months from the current day. Currently, in my query I’m using the criteria …
Unexpected results from query pulling oldest 50 songs in database with unique artists
I’ve got a music player system which is supposed to play each song in my database, mostly randomly, before repeating any songs. My problem is, there are some very old songs in the database that are being skipped. My query is set up to pull the 50 oldest songs in the database but with no duplicate artist…
I am trying to access the data stored in a snowflake table using python sql. Below is the columns given below i want to access
Below is the data-sample and i want to access columns value,start. This data i dumped in one column(DN) of a table (stg) ##consider many lines stored in same column in different rows. Below query only fetched data for name. I want to access other columns value also. This query is a part of python script. Do i…