I have the following table in Vertica: The table is ordered by column_1 and column_3. I would like to add a row number, which increases every time when column_1 or column_3 change their value. It would look something like this: I tried using partition over but I can’t find the right syntax. Answer Verti…
What does .* (dot star) mean in SQL?
What does the .* mean in SQL? I saw it in this query: Answer The * means “all columns”. Combined with the . and the prefix it means “all columns from the table/alias named”. So in your case means “select all columns from the socialmeda_kat_stundenvorlagen table”. You can do…
Avoid ‘out of shared memory error’ in PostgreSQL function
I have two tables, a table called companies_display with information about publicly traded companies such as ticker symbol, market cap etc. and a partitioned table stock_prices with the historical stock prices for each company. I want to calculate the beta of each stock and write that into companies_display. …
Given a list, how to get the count from mysql table?
Given a string list, I want to get the count of each item from the table. However, I don’t know how to get the count(0) of item which does not exist in the table. for example, I have a table as follow. Given a list [“aaa”, “bbb”, “ccc”] , I hope a query can return me …
Insertion of dynamic values to specific colums using SQL
I’m trying to insert a new row into a table, but one column’s value insertion is dependent on a specific rule. So far I get an error because SQL doesn’t support my way and I have no idea what to do: How can I insert the max(RNFIL170.SEDER_HATZAGA)+1 into RNFIL170 ? Answer use INSERT INTO …
Getting unique record based on max conditions including null values
I need to get back one record of a player’s (Rank A players only) most recent win date (some win dates are null but we need to include them) but picking only the last place of their most recent game session. So basically in that order: get their max win_date (if null, still include them) > from there…
QUERY to find matches across a range
I would like to count the total occurrences of series that have “Action” as a main genre and then “Magic” as one of it’s other tags. Currently I have: L being the row where the main genre is listed. Following that row (M:BM) are a bunch of tags. Is it possible to use query to tal…
How can I make these Active Record queries faster?
I’m using Active Record to send a few queries to a postgres database. I have a User model, a Business model and a joiner named UserBiz. The queries I mentioned go through the entire UserBiz collection and then filter out the businesses that match user provided categories and searches. These “work&…
Import an Excel Sheet with File Dialog in Access
I have a splitform where I want a button to choose and import a file into a table. I have something like this: I set the reference to Microsoft Office 16.0 Object Library. When I tried using this button there was this error: Method ‘FileDialog’ of object ‘_Application’ failed. Answer I…
SQL server Change Column datatype on 1K million records
I am facing the column length issue in my table and I want to change column type to big int from int and table rows around 1K million records but when ever I tried to change data type it is taking to much time and it is eating my machine all space, what is best way and fast way to