SQL
The language used to query and change relational data. The same SQL used everywhere else, running against mainframe tables.
Also written Structured Query Language
SQL, Structured Query Language, is how relational data is read and written. On the mainframe it works against DB2 tables, and the language itself is the standard one used across the industry.
The core statements are the familiar four. SELECT retrieves rows, with conditions, ordering, grouping and joins across tables. INSERT adds rows. UPDATE changes existing ones. DELETE removes them. Alongside those sit the statements that define tables, indexes and views.
The thing that differs on z/OS is not the syntax but the context. SQL can be run interactively for enquiry and testing, and it can be embedded directly inside a COBOL program so that business logic and data access sit in the same source file. Embedded SQL goes through an extra preparation step before the program can run.
Because these systems are large, how a query is written has consequences. A statement that scans a table of two billion rows rather than using an index will work correctly and take a very long time, and learning to notice the difference is part of the job.
Related terms
- DB2 for z/OSIBM's relational database on the mainframe, where a great deal of the world's banking and insurance data is stored.
- Embedded SQLSQL statements written directly inside a COBOL program, marked off so they can be prepared before compiling.
- IndexA structure that lets a database find rows by value without reading the whole table.
- Primary keyThe column or columns that uniquely identify each row in a table, so no two rows share the same value.
- CursorA mechanism for stepping through a set of rows one at a time, when a query returns more than one result.