The syntax and logic of SQL
As mentioned earlier, SQL is an easy to use and understand language capable of many different types of operations. Like all languages, it is based on interpreting command strings that are inserted with an expected syntax, with specific statements corresponding to one and only possible operation. SQL's main statements can be of many types. Let's take a look at the most important ones:
- SELECT statement:
SELECT
is the most common SQL command. Its purpose is to allow the database to be searched, showing the specified attributes from the records that satisfy (optionally) a specific condition; for example:SELECT color, shape FROM objects
This statement shows the
color
andshape
attributes of all the records from theobjects
table. SQL also allows for a wildcard – in this case, the character*
– to make general selections:SELECT * FROM objects
- This statement will return all the records from
objects
table, showing all the attributes...