How do I join two tables from a database in SQL?

I’m currently working on a project where we have to join two tables in SQL and then create a page to show the result of the two tables combined. This is what I have so far: SELECT * FROM ANIMAL …

PostgreSQL – How to find the row with a record that matches it with a value higher than given value?

Let’s say I have two tables with a 1-to-many relation. Table A (user): id INT, name TEXT Table B (skill): id INT, user_id INT, skill_name TEXT, skill_level INT Each user may have multiple skills. And …

How do you populate boolean columns based on a table of properties?

I have a table called Product that contains a product identification number and an id associated with the product identification number. pin id 11 10 12 11 13 12 I also have a property table with the …

How to get the third level of a tree in SQL

I aim to list the forth generation of a family using SQL Server. Example family tree in the picture (id based) FAMILY TREE The tables I have are: Family +——+—————–+ | f_id | f_name …

SQL query is only returning one entry, when it should be returning several

I am creating a book tagging system and I am trying to call all the books with the same tag. My query is only turning up the first book, and not any of the following books with the same tag. Here is …

How to select rows in parent table based on a value in child table

Consider the following tables, what would be an efficient query to return 1 row for each order that has at least 1 child row with a specific warehouse code? I am using SQL Server 2016. Table: Orders …

Get Name from characters that died on Episode3 with its killer

I have a doubt on this sql problem. Here is the tables. I currenly have all the characters names that died on Episode 3, but I don’t know how to get the character killers. Any idea? Select name from …

Calculate a column value backwards over a series of previous rows/RECURSIVE/CONNECTED BY

need your help. I guess/hope there is a function for that. I found “CONNECT DBY” and “WITH RECURSIVE AS …” but it doesn’t seem to solve my problem. GIVEN TABLES: Table A +——+-…

Oracle Merge – Can I do something like “When Not Matched Then Delete”?

I have a table (t1) with a unique list of patients. I have another table (t1_Backup) with a duplicative list of patients and details. I would like to essentially perform an inner join to update t1, …

2 dimensional table query with join and PostgreSQL [closed]

Trying to return a 2 dimensional table from SQL query (Postgres). Read about Pivot Table (but not sure if it is valid for join) and crosstab/tablefunc but no luck. Expected result App A | …