Skip to content
Advertisement

Tag: inner-join

PostgreSQL: Sub-Query on one table

My table looks (simplified) like this: It records filenames “File”; sometimes, a file (here BBB) is replaced by a newer one (here CCC”. First show all records, that have been replaced: OK, brings up line 2. Now I need to add a subquery column QQ, which shows the File of the substitute record, e.g. should bring: . My approach does

SQL Query results into a already created table

I need some help getting the results from this query: To go into a table I have already created (Routegen). Routegen already has the columns (RouteNumber, DPS, Flats, Parcels). I’ve tried using SELECT INTO, but apparently I’m not doing it right because I can’t get the code to run after changing it. The main goal here is to compare then

Query Optimization in SQL in given case

These are the given tables: Question is: Write a optimized query to find out the name of all the customerIDs who ordered coffee that originated from ‘Costa Rica’ or ‘Indonesia’. My attempt: My teacher says it can be optimized more but I don’t see any way. Please Help me out. Answer Rather than these nested in subqueries, I would recommend

Advertisement