Description
SQL is a non-navigational language. What does that mean? With some databases, the calls to access the data instruct the system to navigate the structure of the database objects. But with DB2, through SQL, the user tells DB2 what data to access, but not how to retrieve it. Rather, with SQL, the access path to the data is determined by the DB2 Optimizer. DB2 always strives to give the user the best possible performance when accessing the data, by minimizing the consumption of system resources (I/O’s and CPU cycles).
The SQL language is quite powerful, and is continually being enhanced with new functions. Oftentimes, there may be more than one way to write a query in order to obtain the results dictated by the logic requirements of the application program. So in that sense, the language is somewhat flexible.
However, as the S implies in the acronym, the language is structured. There is a format that needs to be followed, there are syntax rules, there are keywords that must be used, etc. We will go into some more detail about SQL later on during the course.
Rules
Every table must be given a name. Also, each of the table’s columns must be assigned three attributes:
- Name
- Data type (and optionally a length)
- Null characteristic
Some data types automatically imply a certain length, so for those data types, no length specification is necessary (or allowed). With other data types, the user needs to specify the desired length (and for decimal numbers, both a precision and scale).