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:
SELECTis 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
colorandshapeattributes of all the records from theobjectstable. 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
objectstable, showing all the attributes...