Database schema for Video Segmentations
CREATE TABLE VxSegmentation_tab ( Id NUMBER NOT NULL, Name VARCHAR2(40) NOT NULL, VideoName VARCHAR2(40) NOT NULL, Description VARCHAR2(80), CONSTRAINT VxSegmentation_pk PRIMARY KEY(id), CONSTRAINT VxSegmentation_uniq UNIQUE(Name, VideoName) ); CREATE TABLE VxSegment_tab ( Id NUMBER NOT NULL, SegIndex NUMBER NOT NULL, SegmentationId NUMBER NOT NULL, StartPos NUMBER NOT NULL, EndPos NUMBER NOT NULL, CONSTRAINT VxSegment_pk PRIMARY KEY(Id), CONSTRAINT VxSegment_uniq UNIQUE(SegmentationId, SegIndex), CONSTRAINT VxSegment_fk FOREIGN KEY(SegmentationId) REFERENCES VxSegmentation_tab ON DELETE CASCADE ); CREATE SEQUENCE VxSegmentation_id INCREMENT BY 1 START WITH 1; CREATE SEQUENCE VxSegment_id INCREMENT BY 1 START WITH 1; CREATE TABLE VxSegmentStringFeature_tab ( SegmentId NUMBER NOT NULL, FieldName VARCHAR2(20) NOT NULL, Value VARCHAR2(512), CONSTRAINT VxSegmentStringFeat_pk PRIMARY KEY(SegmentId, FieldName), CONSTRAINT VxSegmentStringFeat_fk FOREIGN KEY(SegmentId) REFERENCES VxSegment_tab ON DELETE CASCADE ); CREATE TABLE VxSegmentDoubleFeature_tab ( SegmentId NUMBER NOT NULL, FieldName VARCHAR2(20) NOT NULL, Value NUMBER NOT NULL, CONSTRAINT VxSegmentDoubleFeat_pk PRIMARY KEY(SegmentId, FieldName), CONSTRAINT VxSegmentDoubleFeat_fk FOREIGN KEY(SegmentId) REFERENCES VxSegment_tab ON DELETE CASCADE ); CREATE TABLE VxSegmentIntFeature_tab ( SegmentId NUMBER NOT NULL, FieldName VARCHAR2(20) NOT NULL, Value NUMBER NOT NULL, CONSTRAINT VxSegmentIntFeat_pk PRIMARY KEY(SegmentId, FieldName), CONSTRAINT VxSegmentIntFeat_fk FOREIGN KEY(SegmentId) REFERENCES VxSegment_tab ON DELETE CASCADE );
All this information can be retrieved from SQL*Plus, using the DESCRIBE
command. Example:
SQL> DESCRIBE VxSegment_tab Name Null? Type ----------------------------------------- -------- ---------------------------- ID NOT NULL NUMBER SEGINDEX NOT NULL NUMBER SEGMENTATIONID NOT NULL NUMBER STARTPOS NOT NULL NUMBER ENDPOS NOT NULL NUMBER
Constraint information can also be obtained from SQL*Plus, querying data dictionary views:
SQL> SELECT c1.constraint_name, c1.constraint_type, c1.delete_rule, c2.column_name, c1.r_constraint_name FROM user_constraints c1, user_cons_columns c2 WHERE (c1.table_name='VXSEGMENT_TAB') AND (c1.constraint_name = c2.constraint_name) AND (c1.generated='USER NAME'); CONSTRAINT_NAME TYPE DEL_RULE COLUMN_NAME R_CONSTRAINT_NAME -------------------- ---- --------- -------------------- -------------------- VXSEGMENT_PK P ID VXSEGMENT_UNIQ U SEGINDEX VXSEGMENT_UNIQ U SEGMENTATIONID VXSEGMENT_FK R CASCADE SEGMENTATIONID VXSEGMENTATION_PK