In this post, you will learn how to collect data from a database using a “SELECT FROM” statement.
Without many words, let’s dive into an example:
SELECT * FROM posts
This query means “Show me all columns from the table named posts“.
The keyword SELECT tells SQL that you are going to query some columns from a table. You can specify columns you had like to query after the SELECT keyword, or we can use a wildcard * to get all columns from the table like in sample bellow:
SELECT post_id, title, text FROM posts
or to get all columns
SELECT * FROM posts
These statements have another keyword named “FROM”, that tells SQL which table should be used to get the data from. For example, to query all columns from the table named “comments”, you will use the following SQL query:
SELECT * FROM comments;
Download dbHarbor for free and try out these queries ⚓️ dbHarbor is a native macOS tool with intuitive UI to manage SQLite databases.
Don’t miss the latest news about our development journey and SQL tutorials. Signup for our newsletter. Promise not to SPAM😎
Pingback: ORDER BY: How to sort data in SQL using ORDER BY clause - dbHarbor
Pingback: MySQL: How To Concatenate Multiple Rows Into Single String - dbHarbor