Next Prev Up Top Contents Index

15.3.2.3 Modification

You may create or drop tables, indexes or views using the following functions.

create-table

Function

create-table name description &key database

Creates a table called name and defines its columns and other properties with description . The description argument is a list of lists of attribute names followed by type information. For example:

(create-table [manager]
  '(([id] (char 10) not-null )([salary] integer)))

is equivalent to the following SQL:

CREATE TABLE MANAGER
(ID CHAR(10) NOT NULL,SALARY INTEGER)

drop-table

Function

drop-table name &key database

Deletes table name from database .

create-index

Function

create-index name &key on unique attributes database

Creates an index called name on table on using attributes . For example:

(create-index [manager]
              :on [emp]
              :unique t
              :attributes '([ename] [sal]))

drop-index

Function

drop-index name &key database

Deletes index name from database .

create-view

Function

create-view name &key column-list as with-check-option database

Creates a view called name using the query as and the optional column-list and with-check-option .

This example creates the view manager with the records in the employee table whose job title is MANAGER .

(create-view [manager]
     :as [select [*] :from [emp] :where
                                 [= [job] "MANAGER"]])

drop-view

Function

drop-view name &key database

Deletes view name from database .


LispWorks User Guide - 14 Dec 2001

Next Prev Up Top Contents Index