Skip to content
Advertisement

Join tables together

I need to write a SQL statement to find the ‘Action’ (category) films with the shortest running time (length). Your query should output the titles and lengths of the films. This is the database schema I have. enter image description here

I created 3 tables and inserted some records on these tables.

I write my query like this:

But there are no rows selected when I execute this query, any hints? Thanks in advance.


Update: Insert some records to tables

My dataset is bit huge and I can only show some of the data.

This is the result I have when I run the formatted code below, it doesn’t work:

enter image description here

Advertisement

Answer

I am assuming you are using Oracle, since you are using VARCHAR2. If no records are returned, I assume you have your database set with case sensitivity on, so ‘Action’ <> ‘ACTION’.

Either change your query so the case is correct, or change the where clause to not be case sensitive, and you should have data returned.

I also hope there are some indexes on the tables which you haven’t mentioned…

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement