카테고리 없음

큐브리드(CUBRID)관련 Auto Increment생성

saltdoll 2010. 1. 13. 20:09
반응형


Auto Incremental :

DDL의 일부로 특정 칼럼에 대해 값을 순차적으로 증가시켜 준다.

AUTO_INCREMENT [ (초기값 , 증감치) ]

CREATE TABLE t_test( id INTEGER NOT NULL  AUTO_INCREMENT, name VARCHAR(10) );

INSERT INTO t_test(name) VALUES ('Andrew');

INSERT INTO t_test(id, name) VALUES (5, 'Gordon');

SELECT * FROM t_test;


CUBRID 응용개발 가이드
http://www.cubrid.com/zbxe/bbs_developer_tutorial/57775


CREATE TABLE(구문):

CREATE { CLASS | TABLE } table_name
[ {UNDER | AS SUBCLASS OF } super_class_name [ {, super_class_name }_ ] ]
TABLE ATTRIBUTE
( table_attr_definition_list ) ]
[ ( attr_definition | table_constraint
[ { , attr_definition | table_constraint_definition }_ ] ) ]
[ METHOD method_definition_list ] ]
[ FILE path_name_list ] ]
[ INHERIT resolution_list [ {, resolution_list }_ ] ] [ ; ]
super_class_name :
[ user_name.]classname
table_attr_definition :
attribute_name datatype { [ DEFAULT value ] | [ NOT NULL ] }
attr_definition :
attribute_name datatype [ { SHARED [ value ] | DEFAULT value } ] [AUTO_INCREMENT ...] [ constraints ]
constraints :
NOT NULL
UNIQUE
PRIMARY KEY
FOREIGN KEY ...
table_constraint_definition :
[ CONSTRAINT constraint_name ] {[ UNIQUE | PRIMARY KEY | FOREIGN KEY ]}
(attribute_name [{, attribute_name} ...])
method_definition :
[ CLASS ] method_name [ ( [ arg_type_list ] ) ]
[ result_type ] [ FUNCTION method_implementation_name ]
arg_type :
datatype
result_type :
datatype
resolution_list :
attr_mthd_name OF super_class_name [ AS alias ]


관련 출처 :
웹 메뉴얼중 CREATE TABLE(구문): http://www.cubrid.com/online_manual/cubrid_821/index.htm

반응형
도움이 되셨다면 하트모양의 "♡ 공감"을 눌러주시면 큰 격려가 됩니다.
(로그인하지 않으셔도 가능)