That's it! This select statement is a query that returns a temporary table with the name column from the friends table.
name
friends
Doesn't CREATE DATABASE just create a database? A statement isn't a query if it doesn't return results.
CREATE DATABASE