Sei sulla pagina 1di 2

RIS SQL Commands Quick Reference

SQL Commands

This quick reference card is designed to give you an easy way


to find the RIS SQL commands. Detailed descriptions can be
found in the RIS SQL Users Guide for 32-Bit Applications
(DNA1116).

alter schema

Schema Creation
Create Schema
Schema Manipulation
Alter Schema
Declare Schema
Default Schema
Drop Schema
Open Schema
Close Schema
Undeclare Schema
Table Creation
Create Table
Table Manipulation
Alter Table
Drop Table
Declare Table
Undeclare Table
Lock Tables
Create Index
Drop Index
View Creation
Create View

View Manipulation
Drop View
Declare View
Undeclare View
Data Manipulation
Insert
Delete
Select
Update
Additional SQL Statements
Grant
Revoke
Commit
Rollback
Exec
Set Database
Set Mode
Set Transaction
Set Network
Nested Queries
SQL Functions
Union
Where Conditions

RIS Datatypes
SQL code

Description

char[acter](n)

CHARACTER

int[eger]

INTEGER

smallint
double
[precision]

SMALLINT
DOUBLE

real

REAL

Maximum of 240 ASCII


characters.
Range -2,147,483,648 to
2,147,483,647.
Range -32,768 to 32,767.
Real number in double
precision floating point
format.
Real number in single
precision floating point
format.
Maximum precision is 15.
Consists of year, month,
day, hour, minute, second
(timestamp yyyy-mmdd:hh:mm:ss or
current_timestamp).
Maximum of 2 gigabytes of
binary data.
Maximum of 2 gigabytes of
variable length character
data.

DECIMAL
TIMESTAMP

ris_blob(n)

RIS_BLOB

ris_text(n)

RIS_TEXT

alter table
alter table <table> add <riscolumn> <datatype>[not null]
[extern <dbmscolumn>];

close schema
close schema {<schema> [, ...] } | ALL;

commit
commit [work] [ for <schema> ];

create index
create [unique] index <risindex>
extern <dbmsindex> on <ristable>
(<riscolumn> [, ...]);

create schema

SQL String

decimal[(p[, s])
timestamp

alter schema <schema>[.<passwd>]


{
to secure |
modify schema password <passwd> |
modify user password <passwd> |
[ , osuser <osuser>[.<passwd>]
[ , remote ( {<protocol> <node> } [, ...])] |
modify db2 password from <passwd>
to <passwd> [ using mode <mode> ] |
include {table [<dbmsuser>. ] <dbmstable>
[ as <ristable> [ (riscolum> [, ...] )] |
view [<dbmsuser>. ] <dbmsview> [as <risview>
[<riscolumn> [, ...])] |
index [<dbmsuser>. ] <dbmsindex>
[as <risindex> ] } |
exclude {table <ristable> | view <risview> |
index <risindex> };

create [secure] schema [authorization] <schema>


[.<passwd>]
[on database (<db_desc> [, remote
(<protocol> <node>
[, <protocol> <node> ...])],
[server version <maj>[.<feature>]]
[user <username>[.<feature>]]
[force] [include | exclude]
[using <user>];
The INFORMIX <db_desc> clause syntax is:
informix, dbname <dbname>, dir <dir>
[, option ([sqlexec= <sqlexec>]
[, dbtemp=< dbtemp>]
[, tbconfig= <tbconfig> ])]
The INGRES <db_desc> clause syntax is:
ingres, dbname <dbname>, ostype
<ostype>, dir <dir>
The ORACLE <db_desc> clause syntax is:
oracle, dbname <dbname>,
dir <oracle_home> | dbms_net,
[osuser <osuser>[.<passwd>],]
ostype <ostype>

The DB2 <db_desc> clause syntax is:


db2, dbname <dbname>, ostype=unix,
[osuser=<user>[.<password>]]
gateway ([arch=<arch>,] [os=<os>,]
{host_program= <host_program>,
ris_lu= <ris_lu>, host_lu= <host_lu>,
mode= <mode>
[net_protocol=<lu 6.2>,]
[env=<cics>,]
| net_protocol=tcp, node=<node>, port=<port>
[env=native,] })
The Rdb <db_desc> clause syntax is:
rdb, dbname <dbname>, ostype <vms>
The SYBASE <db_desc> clause syntax is:
sybase, dbname <dbname>,
[osuser <osuser>[.<passwd>],]
ostype <ostype>, dir <sybase-interfacesfile-path>
[, option (dsquery=<sybase-server-name>,
filename=<sybase-interfaces-file-name>)]
The OS400 <db_desc> clause syntax is:
os400, dbname <dbname>, ris_dict_dbname
<ris_dictdbname>, ostype <unix>,
[osuser=<userid>[.<password>],]
gateway { net_protocol=<appc | APPC>,
mode=<mode>, ris_lu=<local_LU>,
host_lu=<remote_LU>,
host_program=<host_program>}

create table
create table <ristable> ({<riscolumn> <datatype>
[not null] }[, ...]) [extern <dbmstable>
{<dbmscolumn> [, ...])]];

create view
create view <risview> [(<column-list>)]
[extern <dbmsview>[(<dbmscolumn-list>)] as
<select-statement>;

declare table
declare table [<schema>.] <table> ({<riscolumn>
<datatype> [not null]}[, ...]) [extern
[<dbmsuser>.<dbmstable>[ (dbmscolumn> [, ...])]]
[with [partial] verify option];

declare view
declare view [<schema>.]<view> ({<riscolumn>
<datatype>[not null]}[, ...]) [extern
[<dbmsuser>.]<dbmsview>[(<dbmscolumn>
[, ...])]] [with [partial] verify option];

declare schema
declare schema <schema>.[<passwd>] [user<username>
[.<passwd>]] [osuser <osusername>[.<passwd>]];

default schema
default schema <schema>[.<passwd>];

delete
delete from [<schema>.] <relation>
[where <conditions>];

drop index
drop index <index>;

drop schema
drop schema <schema> [.<passwd>][force];

drop table
drop table <table>;

drop view
drop view <view>;

exec
exec <database-type> <string>;

grant (to schema)


grant <rel-privileges> on [<schema>.] <relation> to
<schema-list> [with grant option];

grant (to user)


grant <rdbmsuser-privilege> to [<rdbmsuser>];

insert
insert into [<schema>.] <relation> [(<column-list>)]
values (<values-list>);
--OR-insert into [<schema>.] <relation> [(<column-list>)]
<select-statement>;

lock tables
lock tables [{[<schema>.]<table>}[, ...] in share mode]
[{[ <schema> .] <table> }[, ...] in exclusive mode]
[{[ <schema> .] <table> }[, ...] in default mode];

open schema
open schema <schema> [, ...];

revoke (from schema)


revoke <rel-privileges> on [<schema>.] <relation>
from <schema-list>;

revoke (from user)


revoke <rdbmsuser-privilege> from [<username>];

rollback
rollback [work] [for <schema> ];

select
select [all | distinct] <column-list> from <relation-list>
[ where <conditions>]
[ group by <column> [,...] ]
[ having <conditions>]
[ order by {<column> | <num> [{asc | desc}]}
[, ... ];

set database
set database enable [all | only <database> [, ...] ];

set mode
set mode [ansi {on | off}] [verify {on | off}]
[blank strip {on | off}] [autorename {on | off}];

set network
set network verification
[timestamp interval <value>,]
[initial timeout <value>,]
[timestamp tolerance <value>,]
[buffer full size <value>,]
[buffer full timeout <value>,]
[response interval <value>]
[for <schema> [,...]];

set transaction
set transaction autocommit {on | off };

RIS SQL Commands


Quick Reference
DNA100340
August 1995
Version 5

undeclare schema
undeclare schema [ALL | <schname1, schname2, ...>];

undeclare table
undeclare table [<schema>.] <table>;

undeclare view
undeclare view [<schema>.] <view>;

union
<select-statement> union [all] <select-statement>
[union [all] <select-statement] [ ... ];

update
update [<schema>.]<relation> set
{<column> = <value>} [, ...] [where <conditions>];

where
where <condition>;
The condition identifier consists of one of the following:
<condition> <boolean> <condition>
not <condition>
<expr> <comparison-op> <expr>
<expr> [not] between <expr> and <expr>
<expr> [not] in (<value-list>)
<column> is [not] null
<char column> [not] like <wildcard-string>
<nested-query>

Nested Query
<expr> <comparison-op> all (<select-statement>)
<expr> <comparison-op> any (<select-statement>)
<expr> <comparison-op> some (<select-statement>)
[not] exists (<select-statement>)
<expr> [not] in (<select-statement>)

SQL Functions
count(*)
--OR-{avg | max | min | sum | count} (distinct <column>)
--OR-{avg | max | min | sum} ([all <expr>)
--OR-user
--OR-current_timestamp

RIS and Intergraph are registered trademarks of


Intergraph Corporation.

Potrebbero piacerti anche