鲁春利的工作笔记,谁说程序员不能有文艺范?



SQL标准里面是有schema的概念的,只是不同的数据库在具体实现的时候出现了差别。在Derby、SQLServer是支持schema的,而Oracle中schema应该对应其实例(orcl),而MySQL中schema应该对应的是其database。
通过create schema lucl;在Derby中创建一个schema,通过DBeaver工具查看:

Derby-10.11学习笔记(三)Derby系统表及存储过程_derby


Derby的系统表位于SYS schema中,但SYS却不是系统默认的schema,因此查询表时需要指定SYS前缀,SYS.TABLE_NAME。Derby的系统表只能查询,无法通过命令修改。

ij> show tables in sys;
TABLE_SCHEM         |TABLE_NAME                    |REMARKS
------------------------------------------------------------------------
SYS                 |SYSALIASES                    |
SYS                 |SYSCHECKS                     |
SYS                 |SYSCOLPERMS                   |
SYS                 |SYSCOLUMNS                    |
SYS                 |SYSCONGLOMERATES              |
SYS                 |SYSCONSTRAINTS                |
SYS                 |SYSDEPENDS                    |
SYS                 |SYSFILES                      |
SYS                 |SYSFOREIGNKEYS                |
SYS                 |SYSKEYS                       |
SYS                 |SYSPERMS                      |
SYS                 |SYSROLES                      |
SYS                 |SYSROUTINEPERMS               |
SYS                 |SYSSCHEMAS                    |
SYS                 |SYSSEQUENCES                  |
SYS                 |SYSSTATEMENTS                 |
SYS                 |SYSSTATISTICS                 |
SYS                 |SYSTABLEPERMS                 |
SYS                 |SYSTABLES                     |
SYS                 |SYSTRIGGERS                   |
SYS                 |SYSUSERS                      |
SYS                 |SYSVIEWS                      |

已选择 22 行
ij>

The SYSALIASES table describes the procedures, functions, user-defined types, and user-defined aggregates in the database.

The SYSCHECKS table describes the check constraints within the current database.

The SYSCOLPERMS table stores the column permissions that have been granted but not revoked.


The SYSCOLUMNS table describes the columns within all tables in the current database.

The SYSCONGLOMERATES table describes the conglomerates(整体情况) within the current
database. A conglomerate is a unit of storage and is either a table or an index.

The SYSCONSTRAINTS table describes the information common to all types of constraints within the current database (currently, this includes primary key, unique, foreign key, and check constraints).


The SYSDEPENDS table stores the dependency relationships between persistent objects in the database.


The SYSFILES table describes jar files stored in the database.

The SYSFOREIGNKEYS table describes the information specific to foreign key constraints in the current database.

The SYSKEYS table describes the specific information for primary key and unique constraints within the current database.

The SYSPERMS table describes the USAGE permissions for sequence generators, user-defined types, and user-defined aggregates.

The SYSROLES table stores the roles in the database.

The SYSROUTINEPERMS table stores the permissions that have been granted to routines.

The SYSSCHEMAS table describes the schemas within the current database.

The SYSSEQUENCES table describes the sequence generators in the database.

The SYSSTATEMENTS table describes the prepared statements in the database.

The SYSSTATISTICS table describes the statistics within the current database.

The SYSTABLEPERMS table stores the table permissions that have been granted but not revoked.

The SYSTABLES table describes the tables and views within the current database.

The SYSTRIGGERS table describes the database's triggers.

The SYSUSERS table stores user credentials(用户凭证) when NATIVE authentication is enabled.

The SYSVIEWS table describes the view definitions within the current database.


Derby默认提供的存储过程如下

SYSCS_SET_DATABASE_PROPERTY
SYSCS_COMPRESS_TABLE
SYSCS_CHECKPOINT_DATABASE
SYSCS_FREEZE_DATABASE
SYSCS_UNFREEZE_DATABASE
SYSCS_BACKUP_DATABASE
SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE
SYSCS_DISABLE_LOG_ARCHIVE_MODE
SYSCS_SET_RUNTIMESTATISTICS
SYSCS_SET_STATISTICS_TIMING
SYSCS_EXPORT_TABLE
SYSCS_EXPORT_QUERY
SYSCS_IMPORT_TABLE
SYSCS_IMPORT_DATA
SYSCS_BULK_INSERT
SYSCS_INPLACE_COMPRESS_TABLE
SYSCS_BACKUP_DATABASE_NOWAIT
SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE_NOWAIT
SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE
SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE
SYSCS_IMPORT_TABLE_LOBS_FROM_EXTFILE
SYSCS_IMPORT_DATA_LOBS_FROM_EXTFILE
SYSCS_RELOAD_SECURITY_POLICY
SYSCS_SET_USER_ACCESS
SYSCS_EMPTY_STATEMENT_CACHE
SYSCS_UPDATE_STATISTICS
SYSCS_SET_XPLAIN_MODE
SYSCS_SET_XPLAIN_SCHEMA
SYSCS_CREATE_USER
SYSCS_RESET_PASSWORD
SYSCS_MODIFY_PASSWORD
SYSCS_DROP_USER
SYSCS_DROP_STATISTICS
SYSCS_INVALIDATE_STORED_STATEMENTS
SYSCS_REGISTER_TOOL


内置的系统函数

SYSCS_GET_DATABASE_PROPERTY
SYSCS_CHECK_TABLE
SYSCS_GET_RUNTIMESTATISTICS
SYSCS_GET_USER_ACCESS
SYSCS_GET_XPLAIN_MODE
SYSCS_GET_XPLAIN_SCHEMA
SYSCS_PEEK_AT_SEQUENCE
SYSCS_PEEK_AT_IDENTITY