Skip to content
Advertisement

Tag: subquery

Find departments with no employees

We were given an assignment in class to provide at the minimum two different solutions to find departments, which don’t have any employees. As you can see from below I completed the task successfully. An additional solution is extra credit, which I like to get. Unfortunately, I can’t think of a third solution and was hoping someone can point me

How do I used distinct to remove duplicates in this query?

I have the following table: Table I am trying to write a query (that I will include in another query) to display how many account numbers there are per symbol. I wrote the following query: The query displays like this but it counts the same account number multiple times per symbol. EURUSD should have 3 and USDJPY should only have

SUBSELECT (SQL)

I have to tables. The first table (customers) shows data about the customers (id, firstname, lastname). The second table shows data about the orders (timestamp and customer id). So, i wanted to see the last order by a customer in my table “customers” and did a SUBSELECT and it worked. But, there are some customers who never ordered something and

Oracle: WITH-clause querying two tables

Using an Oracle database, I have two tables: I am supposed to find – using the WITH-clause – all the employees who currently work in the same department where they started to work (hire_date = start_date and same department_id). I easily got the right result using a JOIN in the subquery: (Right) OUTPUT: Unfortunately with the WITH-clause I am getting

Python Script to run SQL query UPDATE statement to loop through each row in result set and update columns

Newby working on my first project. Sorry for this explanation. I have 2 x tables: t1: master table with single rows (unique project-id) and 3 status fields, s1,s2,s3 t2: list table with repeating project_id’s with 3 status fields s1,s2,s3 (and other data not relevant here). The value in the s1-3 fields is either true(1) or false(0) table1: project_id, status1, status2,

Advertisement