Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

-->DataTypes:-

*The datypes are used to ensure, what kind of data needs to be stored or
entered into the perticular memory location.

-->Types of DataTypes:-

1.CHAR
2.VARCHAR/VARCHAR2
3.DATE
4.NUMBER
5.LARGE OBJECT
a.CHARECTER LARGE OBJECT(CLOB)
b.BINARY LARGE OBJECT(BLOB)

1.CHAR:-

*Anything which is enclosed within a single code(' '), is called as CHAR DT


*CHAR DT can accept A-Z,a-z,0-9,special character, and alphanumerics.
ex:- ['ABC', 'abc','0123456789','@#$%^&*(())_+','Abc8$']
*Whenever we are using CHAR DT, we should mention the size
*The maximum size is 2000
Syntax:- CHAR(SIZE)
*CHAT DT follows "Fixed length memory allocation"

2.VARCHAR

*Anything which is enclosed within a single code(' '), is called as VARCHAR DT


*VARCHAR DT can accept A-Z,a-z,0-9,special character, and alphanumerics.
ex:-['ABC', 'abc','0123456789','@#$%^&*(())_+','Ab8$']
*Whenever we are using VARCHAR DT, we should mention the size
*The maximum size is 2000
Syntax:- VARCHAR(SIZE)
*VARCHAR DT follows "Variable length memory allocation"

-->VARCHAR2:-
*It is the updation of varchar.
*It follows Varchar DT
*The maximum size of varchar2 DT is 4000.
Syntax:- VARCHAR2(SIZE)

3.DATE:-

*It is used to store the date in perticular format


*That perticular format is Oracle format.
Syntax:- DATE
DD-MON-YYYY-->'06-Feb-2023'
OR
DD-MON-YY-->'06-Feb-23'

4.NUMBER:-
*It is used to store numeric values.
Syntax:- NUMBER(PRECISION[,SCALE])

*PRECISION:-

*It is used to store the "integer values"


*The range of precision is 1 to 38.
*SCALE:-

*It is used to store the "decimal values".


*The range of scale is 0 to 127.
*The default value of scale is always '0'.

NUMBER(PRECISION[,SCALE])

NUMBER(7,3)=_1 _1 _1 _1._1 _1 _1

NUMBER (5,4)= _2._2 _2 _2 _2

NUMBER (5)=_3 _3 _3 _3 _3

NUMBER (6,6)=._4 _4 _4 _4 _4 _4

NUMBER (3,5)= ._0 _0 _5 _5 _5

NUMBER (2,8)=._0 _0 _0 _0 _0 _0 _6 _6

5.LARGE OBJECT

a.CHARECTER LARGE OBJECT(CLOB)

* It is used to store huge amount of CHARECTER Values upto the size of 4GB.
Syntax:- CLOB

b.BINARY LARGE OBJECT(BLOB)

*It is used to store huge amount of BINARY Values upto the size of 4GB.
Syntax:- BLOB
-----------------------------------------------------------------------------------
---------------

CONSTRAINTS:-

*Constraints are the rules given to validate the data(column)

-->Types of CONSTRAINTS:-(5)

1.UNIQUE CONSTRAINTS
2.NOT NULL CONSTRAINTS
3.CHECK CONSTRAINTS
4.PRIMARY KEY CONSTRAINTS
5.FOREIGN KEY CONSTRAINTS

1.UNIQUE CONSTRAINTS:-
*It is constraints which cannot accept repeated or duplicated values.

2.NOT NULL CONSTRAINTS:-


*It is a constraint which cannot accept null values.

3.CHECK CONSTRAINTS:-
*It is a extra validation assigned to the column with a condition.
*If the condition is satisfied, it returns true(o/p).
Ex:-Syntax:- CHECK(LENGTH(COL_NAME)=SIZE)
4.PRIMARY KEY CONSTRAINTS:-(PK)
*It is a constraint, which is uniquely identifies the records from the table.

-->Characteristics of Primary key:-

*Pk cannot accept duplicated or repeated values.


*Pk cannot accept null values
*Pk is the combination of UNIQUE and NOT NULL constraints.
*The table can only accept one column as a PK
*Pk is not mandatory, but it is highly recommended.

5.FOREIGN KEY CONSTRAINTS:-(FK)


*It is a constraint which is used to establish the connection between two tables.

-->Characteristics of Foreign key:-

*This can accept duplicated or repeated values


*It will also accept null values
*It is not a combination of UNIQUE and NOT NULL constraints
*The table can accept more than one column as a FK
*If a column wants to become a FK, it is mandatory for Pk to be on its own table.
*Fk is present in child table, but it belongs to parent table.
*FK is also called as "referential integrety constraints".
-----------------------------------------------------------------------------------
----------------

You might also like