Skip to main content

📜 Learning SQL: Queries

 What is a Query?

A query is really a question or request for data. Remember that a database stores information in tables, consisting of rows and columns of information. The database fields are the columns. They tell the database what to store, such as an album title. The rows make up the data.

Here is some sample data to work with.

SELECT * FROM USERS

This statement above means SELECT everything FROM USERS (table in the database)

In SQL, we actually have keywords that match our statement. We will say SELECT, (go get from the database), FROM (which table are you looking at?), and WHERE (what criteria?).
 

To get all the data, use the **asterisk (*)** in the code. The asterisk indicates a wildcard, --meaning we want everything--. This is the equivalent of asking the librarian for all the books in the library.


Imperative and Declarative