This can easily be scripted, but I would like to learn how to do it in just pure SQL. I have a users table. In the users table, id is the primary key. Now imagine I have a new table called foos. Each user can have one foo. I’d like to be able to create a row (doesn’t matter if data is the same right now) for every user I have in the users table into the table foos. foos just has just two columns, user_id,name.
What’s the best way to loop through users and create an accompanying row in foos for each user where user_id is the user.id and name is any random string.
OR
OR (with a little bit of fun)
since,