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 id, username, email FROM users

Read data from multiple tables without join

SELECT * FROM users, accounts
SELECT, users.username,, 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
FROM accounts
WHERE country= ‘USA’);

Leave a Comment

Your email address will not be published.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.