Reputation: 21
Given the following two tables:
p_id
and name
u_id
and password
I want to create a 3rd table named review, which will have the following 3 columns: p_id
, u_id
, review
. The p_id
and u_id
are taken from products and users table respectively, and would kind of create a Cartesian product of the above two tables with added third column to it. How can I do that?
Upvotes: 0
Views: 85
Reputation: 133400
You can create with select
create table3 (p_id int(1), u_id int(11), review varchar(64));
insert table3 select Products.p_id, Users.u_id, 'value_for_review'
from Products, Users
Upvotes: 2