Read this SQL tutorial to learn when to use SELECT, JOIN, subselects and UNION to access multiple tables with a single statement. It’s sometimes difficult to know which SQL syntax to use when ...
The proper way to sanitize data for insertion into your database is to use placeholders for all variables to be inserted into your SQL strings. In other words, NEVER do this (Python example): This ...