Database Table Definitions And Data Types
|
Invalid SQL Table and FIELD Names |
Description |
|
STUDENT TABLE |
Spaces not permitted |
|
STUDENT-TABLE |
Hyphens not permitted |
|
#CUST |
Must begin with a letter |
|
US_SOCIAL_SECURITY_NUMBERS_COLUMN |
Cannot exceed 30 characters |
CREATE TABLE tablename
( fieldname data_type_specification,
fieldname2 data_type_specification, ….. );
Data Types
Character Data Types
VARCHAR2 Character Data Type
variable-length : maximum 4,000
s_last VARCHAR2 ( 30 )
CHAR Character Data Type
s_class CHA ( 2 )
stores character and blank spaces to fill all length.
NCHAR Character Data Type
supports 16-digit ( two byte ) binary character codes.
NUMBER Data Types
supports : negative, positive, fixed, and floating-point numbers.
10 * -130 and 10 * 126 with precision up to 38 decimal places. not support formatting characters.
integer :
s_id NUMBER ( 5 )
fixed-point number :
price NUMBER ( 5 , 2 )
floating-point number :
s_gpa NUMBER
DATE Data Type :
s_dob DATE
Large Object ( LOB ) Data Types
|
Large Object ( LOB ) Data Type |
Description |
|
BLOB |
Binary LOB, storing up to 4 GB of binary data in the database |
|
CLOB |
Character LOB, storing up to 4 GB of binary data in the database |
|
BFILE |
Binary File, storing a reference to a binary file located outside the database in a file maintained by the operating system. |
|
NCLOB |
Character LOB that supports 2-byte character codes, stored in the database. |
item_image BLOB
item_image BFILE
Constraints
key definitions: integrity constraints, value constraints , table constraints, column constraint,
foreign keys, unique, not null, primary key

Leave a Reply