The SELECT statement allows you to read data from one or more tables. The output of a this statement is called results or a result set.
Read data from one table
//read data from table named users SELECT * FROM users SELECT id, username, email FROM users
Read data from multiple tables without join
SELECT * FROM users, accounts SELECT users.id, users.username, accounts.country, accounts.phone FROM users, accounts
If table users doesn’t have any data, no result is returned from table accounts as well. So the results is empty.
SELECT based on value of another SELECT
SELECT id, username FROM users
WHERE fullname IN (SELECT fullname
WHERE country= ‘USA’);