Skip to content
Advertisement

Tag: exists

Update query with join and where clause

I’m currently confused with a (fairly easy) update statement that I’m trying to execute on a table. The two tables are as such: Customer table has the columns Loan table has the columns I would like to update the passworddisabled attribute to true if they are registered via a specific cash register. I’ve made use of the distinct command because

SQL query for EXCEPT or NOT IN

I’m new to SQL and I am trying to write a query on PostgreSQL to find the cust_ID and customer name of each customer at the bank who only has a loan at the bank, and no account. The database schema is: The results should have only these 3 customers: My two attempts for this query are: 1) Where my

Changing In to Exists in SQL – with DISTINCT

Having this one: Reading this one: Changing IN to EXISTS in SQL Tried to change it into “Exists”, but produced this and it did not work: The error is 3706: Syntax error: expected something between ‘=’ and ‘DISTINCT’ keyword. Answer You have already redundant code. Inside the IN subquery you are selecting a column from ORGHEADER, so the LEFT join

How to select rows where multiple values do not exist

Scenario: Charlie, Amy and Robert have each filled out a survey which asks the user to select all the sports they are interested in. The question is multiple choice. In the table surveyData each row represents one of the answers each user chose. so Charlie(0001) chose basketball, rugby, acrobatics and darts. I would like to select from the table all

Advertisement