I had a situation arise where I needed to insert data into a linking table where one column was made up of ids from one table, but the other column was set to a default value (1). Never did this type of query before so had a bit of a struggle with it, but finally figured it out.


INSERT INTO linking_book_category (book_id, category_id) SELECT book.id, 1 FROM books AS book;

Notice the 1 after SELECT book.id.