SQL BASIC QUERIES YOU NEED TO KNOW PART 1
Published in
12 min readJan 21, 2023
SQL (Structured Query Language) is a programming language used for managing and manipulating relational databases. It is used to insert, update, and retrieve data from a database.
Here are some basic examples of SQL commands:
SELECT: The SELECT statement is used to retrieve data from one or more tables in a database.
The basic syntax for a SELECT statement is:
SELECT column1, column2, ...
FROM table_name
WHERE some_column = some_value;
- The
SELECT
clause specifies the columns that you want to retrieve. You can specify one or more columns by separating them with a comma. You can also use the wildcard character*
to select all columns. - The
FROM
clause specifies the table from which you want to retrieve data. You can specify one or more tables by separating them with a comma, but you would need to use aliases to distinguish the columns coming from different tables. - The
WHERE
clause is used to filter the rows based on certain conditions. It specifies one or more conditions that must be met for a row to be included in the result set.
Let’s consider an example where we have two tables “customers” and “orders”