Question: i have a database and i want to retrive data from 3 tables and i want to use condition WHERE, but when the information retrived
i have a database and i want to retrive data from 3 tables and i want to use condition "WHERE", but when the information retrived its gaves me null data, how i can ritrive only data without null values
This is the picture with Query without condition and all the data retrived

and this with the condtion in the last, and as you can see its return null data,

And this is all my tables

How i can fix this please, i just want to search for specific catogery and type in the cars table
Run Run Selected Auto complete Clear SQL statement: SELECT cars car_id", 'cat' category', 'type', 'type','cars", car_name', 'type' rental_cost', 'type': 'max_passengers', 'type' comfort_level' FROM cars' left join 'cat' on cars.cat_id = 'cat.cat_id" left join `type cars.type_id' = 'type': 'type_id | jdbch2:-/car_rent # D ACCOUNTS # E CARS + E CAT # TYPE F INFORMATION_SCHEMA # # Sequences # Users 1 H2 1.4.186 (2015-03-02) SELECT cars". car_id", 'cat". "category", "type". "type", cars". car_name', 'type 'rental_cost,"type""max_passengers","type" comfort_level' FROM cars' left join.cat on cars" cat_id` = 'cat'. cat_id" left join `type On cars". "type_id' = "type". "type_id"; CAR_ID CATEGORY TYPE CAR_NAME RENTAL_COST MAX_PASSENGERS COMFORT_LEVEL 1 SUV Standard Subcompact 55 5 Good 2 Sedan Intermediate Toyota Avalon 2021 50 4 Medium (2 rows, 0 ms) Run Run Selected Auto complete Clear SQL statement SELECT cars car_id", 'cat'. "category", 'type''type', 'cars cac_name", "type", "rental_cost", "type", "max_passengers","type". comfort_level" FROM cars' left join `cat on cars'. cat_id' = 'cat'. cat_id" left join `type On 'cars" type_id" = type""type_id AND 'cars' cat_id' = 2 AND `type" type_id' = 1; jdbc:h2:-/car_rent ACCOUNTS CARS CAT TYPE INFORMATION_SCHEMA Sequences + Users H2 1.4.186 (2015-03-02) SELECT cars'car_id", 'cat'. "category", 'type': 'type', cars", car_name", "type": "rental_cos","type", "max_passengers","type". comfort_level" "type":"type_id' AND 'cars'. cat_id' = 2 AND `type""type_id' = 1; CAR_ID CATEGORY TYPE CAR_NAME RENTAL_COST MAX_PASSENGERS COMFORT_LEVEL SUV null Subcompact null null null 2 Sedan null Toyota Avalon 2021 null null null (2 rows, 0 ms) 1 Run Run Selected Auto complete Clear SQL statement SELECT * FROM CARS:/ SELECT * FROM CAT; SELECT * FROM TYPE: jdbc h2:-/car_rent ACCOUNTS CARS CAT TYPE INFORMATION_SCHEMA Sequences Users H2 1.4.186 (2015-03-02) SELECT * FROM CARS CAR_ID CAT_ID TYPE_ID CAR_NAME 1 1 Subcompact 2 2 Toyota Avalon 2021 (2 rows, 0 ms) 3 3 SELECT * FROM CAT; CAT_ID CATEGORY 1 SUV 2 Crossover 3 Sedan 4 Truck 5 Coupe 6 Hybrid 7 Van/Minivan (7 rows, 0 ms) SELECT * FROM TYPE: TYPE_ID TYPE RENTAL_COST MAX_PASSENGERS COMFORT_LEVEL 1 Economy 45 4 Poor 2 intermediate SU Medium 3 Standard 55 5 Good 4 Van 70 7 Medium (4 rows, 1 ms) 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
