First Guide to SQL Anywhere Studio
PART 3. Basic SQL
CHAPTER 18. System Tables
The first system table lists all the tables in the database.
Type the following command:
SELECT * FROM sys.syscatalog
The first screen of tables lists some of the system tables found in Adaptive Server Anywhere.
Scroll through the Interactive SQL data window a few times, you will see the tables that make up the company database.
The owner of the system tables is the special user ID, SYS and the owner of the company tables is dba. In addition, there is a set of views owned by the special user ID DBO, which provide an emulation of the Sybase SQL Server system catalog; these tables are not discussed in this section.
Recall that dba is the user ID you used when connecting to the database from Interactive SQL. So far, you have simply typed the table names employee and department; SQL looked in SYSCATALOG for tables with those names created by dba. In this example, by typing SYS.SYSCATALOG you specified that SYSCATALOG was created by the user ID SYS. Note the similarity to the way column names are qualified, such as employee.emp_id.
The other columns in this table contain other important information. For example, the column named Ncols is the number of columns in each table, and the column named tabletype identifies the table as a permanent table (also called a base table) or a view.