SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table recipe ( recipe_id serial, name varchar ); insert into recipe (name) values ('Pasta'), ('Pizza '), ('Fish'); create table ingredient ( ingredient_id serial, name varchar ); insert into ingredient (name) values ('Spaghetti'), ('Salmon '), ('Tomato sauce'); create table recipe_ingredient ( id serial, recipe_id int, ingredient_id int ); insert into recipe_ingredient (recipe_id, ingredient_id) select recipe_id, ingredient_id from recipe, ingredient where recipe.name = 'Pasta' and ingredient.name in ('Spaghetti', 'Tomato sauce'); select * from recipe_ingredient;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear