Skip to content
Advertisement

Tag: sql

Real number comparison for trigram similarity

I am implementing trigram similarity for word matching in column comum1. similarity() returns real. I have converted 0.01 to real and rounded to 2 decimal digits. Though there are rank values greater than 0.01, I get no results on screen. If I remove the WHERE condition, lots of results are available. Kindly guide me how to overcome this issue. I

Insert differences between 2 tables into 3rd table

I have total of 3 tables in my database. My Testing1 and Testing2 table have two exact columns (ItemID and ItemPath). My Testing3 have three columns (ItemID, ItemPath and Source). I’m trying to compare Testing1 with Testing2 and insert the difference to Testing3. I’m able get the the difference but I’m just wondering how can modify it to meet this

Right join to an incremental date table not working in SQL

I have two tables. The first is a date_incremental table just holing dates from 1900-01-01 to current in yyyy-mm-dd format. The second table has user behavior. Here are the tables in visual form: date_incremental The user table Now, I want to get a table output where no date gaps exist between the users purchases, i.e. display the history subsequently. If

SQLite: optimize query with union

This is my table definition: And this is my query + plan: So the index is used, but there is still a scan and a b-tree involved in the order by. I tried getting rid of them by adding more indexes, but I don’t get it working. Any ideas of an index which gets rid of the scan? Answer Your

Query based on JSON object values

If I have a column(lets call it students) in a PostgreSQL db in a JSON/JSONB format like such: How can I query the students who have passed? Ideally, I’d write something like SELECT (students->’student_id’) FROM table_name WHERE (students->’Pass’)=true, but that doesn’t work because it has the missing layer of keys i.e “1”, “2” and “3”. Something that has its logic

Count and Group by 2 different columns SQL

I have below table and want to find out a count and group by that will show the number of times republic of ireland played a particular opponent regardless if they are the home team or away team I want something that will show like the below Thanks for help! Answer This is how I would do it — normalize

Google BigQuery: join on an join Alias

i try to perform an join on a table that is the result of an other join. But i recieve the error: Table “join_1” must be qualified with a dataset (e.g. dataset.table). I bolded the Problem. Thanks a lot in advance. How can I qualify table join_1? I edited the table, I hope that helps to understand the problem more.

Advertisement