SELECT

SQL is a language used to retrieve data from a database. Its basic structure
consists of 2 words, and that is SELECT and FROM. SELECT contains the
information we want to find out. The FROM clause tells us which table we
want to search in.

The database table is where the information is stored. It can be, for
example, a table of customers, suppliers, colors, prices, a list of products.

When designing tables structure, we always try to have adequate
granularity, and we should not have
too general tables.

If we look closely at the Colors table, we can see what information is in it.
Let’s write down everything (*).

Structure:
SELECT *
FROM table_name;

 

Example1:

SELECT *
FROM colors;

The result is all the records in the Colors table.

 

Now we are only interested in a specific color, the color pink.

SELECT column_name1, column_name2
FROM table_name;

Example2:

SELECT color
FROM Colors;

Result:

Leave a Comment

Your email address will not be published. Required fields are marked *