Skip to main content

Tables

Tables

Within InterSystems SQL, data is presented within tables. Each table is defined to contain a number of columns. A table may contain zero or more rows of data values. The following terms are roughly equivalent:

Data Terms Relational Database Terms InterSystems IRIS Terms
database schema package
table persistent class
field column property
record row  

For further details, see Introduction to the Default SQL Projection.

There are two basic types of tables: base tables (which contain data and are usually referred to simply as tables) and views (which present a logical view based on one or more tables).

To find out more on how to define tables, see Defining Tables.

To find out more on how to define views, see Defining Views.

In order to make queries against tables more efficient, you can define indexes on tables. See Defining and Building Indexes.

In order to enforce referential integrity you can define foreign keys and triggers on tables. See Defining Foreign Keys and Defining Triggers.

Schemas

SQL schemas provides a means of grouping sets of related tables, views, stored procedures, and cached queries. The use of schemas helps prevent naming collisions at the table level, because a table, view, or stored procedure name must only be unique within its schema. An application can specify tables in multiple schemas.

SQL schemas correspond to persistent class packages. Commonly a schema has the same name as its corresponding package, but these names may differ because of different schema naming conventions or because different names have been deliberately specified. Schema-to-package mapping is further described in SQL to Class Name Transformations.

Schemas are defined within a specific namespace. A schema name must be unique within its namespace. A schema (and its corresponding package) is automatically created when the first item is assigned to it and automatically deleted when the last item is deleted from it.

You can specify an SQL name as qualified or unqualified. A qualified name specifies the schema: schema.name. An unqualified name does not specify the schema: name. If you do not specify the schema, InterSystems IRIS supplies the schema as follows:

To view all the existing schemas within a namespace:

  1. From the Management Portal select System Explorer, then SQL. Select a namespace by clicking the name of the current namespace displayed at the top of the page; this displays the list of available namespaces. Select a namespace.

  2. Select the Schema drop-down list on the left side of the screen. This displays a list of the schemas in the current namespace. Select a schema from this list; the selected name appears in the Schema box.

  3. The applies to drop-down list allows you to select Tables, Views, Procedures, or Cached Queries, or All of these that belong to the schema. After setting this option, click the triangles to view a list of the items. If there are no items, clicking a triangle has no effect.

FeedbackOpens in a new tab