For Example.: Table 1 – Projects Id Name Master Project Active 1 Project A N 2 Project A – 1 1 Y 3 Project A – 2 1 N 4 Project B N 5 Project B -1 4 N 6 Project C NULL 7 Project C – 1 6 Y I …
Is there any way in Oracle to skip a value in a select when it has been already shown?
Sorry because maybe it’s a silly question but honestly I don’t know how to handle it. Let’s imagine that after executing a select with a group by clause I have the following information: But I would like to obtain the following: In other words, I don’t want to show a previously shown v…
Combining two sql queries into one to get most popular questions & answers in single table from SEDE
I have a query to get the most popular questions from the SEDE by SELECT TOP 10 ‘https://stackoverflow.com/questions/’ + CONVERT(VARCHAR, Posts.Id) as url, (ViewCount / (SELECT – DATEDIFF(DAY, …
Added a trigger function for inserts on a TABLE, but the function is not receiving the value from NEW.user_id
I have created a Trigger function, and have added it to a table. I’ve also tested the function to make sure it’s firing by replacing my NEW.user_id value in the trigger function with a static one (…
How to check if a value exists in an array type column using SQL?
I am having a bigquery table with many columns including one array type column of zero or many integers. For instance: Using BigQuery SQL, I want to generate another column exists if any value of tuple (3, 10) is included in some_numbers arrays. My desired output: How can I do this? Answer Consider below appr…
How does PostgreSQL implement the REPEATABLE_READ isolation level?
The REPEATABLE_READ transaction isolation level of PostgreSQL 12 prevents dirty reads, non-repeatable reads, and phantom reads. In contrast to the READ_COMMITTED isolation level, the REPEATABLE_READ …
Extract date from a column
How to extract date from a string like ‘2:24 PM 6-20-2021’? For example, I have a column called Dates (datatype ‘String’) in the table like below – The output should be Answer How to extract date from a string? If you want to extract date as a date type so you will be able then t…
Create a function that accepts a string and returns multiple rows
I’m being required to create a function that transforms a single column’s value based on the user’s input. I need some help on the syntax for doing so. Here is the query I’m currently performing to get the rows: some pseudocode on what I’m trying to do: I’ve been trying to …
Select to pull Zip code based both foreign and domestic
I need to write a T-SQL procedure where the parameter is zip code. We’ve got the following parameter declared. Sample data in table: postal_codes NULL 46383 074523632 B4H34 113601419 ZH/8600 A1G 9Z9 WN73R Wd3 3he 89136 etc. We’ve got a variety of addresses some having no postal code for certain fo…
How to copy data from one column to another?
I am trying to add Property Address in columns that have a missing value. I use the below to identify common parcel IDs with corresponding property address since the same parcelIDs have the same PropertyAddress as well. I get this result: Now I want to add the data in column IFNULL(n.PropertyAddress,n2.Proper…