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

Datatypes:

NUMBER

NUMBER --TO STORE NUMBERS OR NUMERIC VALUES.


NUMBER(10, 2) --1234567.89, 98765.43, 123.45.

CHAR --CHAR data type, which stores fixed-length strings


2000 character, Number, Special Character.
But its length only 2000 ie Name CHAR(2000).

CREATE TABLE Employee (FirstName CHAR(20), LastName CHAR(20));

VARCHAR2

VARCHAR2 -- data type is used to store variable-length character strings.

4000 character, Number, Special Character.


(variable character)

VARCHAR2 data type is used to store variable-length character strings.

CREATE TABLE Product (ProductID NUMBER, ProductName VARCHAR2(50));

LONG: 2GB character,Number,Special Character. (only once in a table)

CLOB (Character Large Object) to handle very large character strings,


and they can store up to 4 gigabytes (GB) of character data.

CLOB data type is commonly used to store:

Text documents
Large textual descriptions
XML documents
JSON data

BLOB 8GB (Binary Large Object) is a data type used to store images, audio, video,
documents, or any other binary data (0,1).

Date date ie (25-jan-2001)

TIMESTAMP 25-01-2001 1:30:13:30

XMLTYPE XML File

DUAL:

DUAL is a one-row, one-column DUMMY table.


DUAL table has a single column and a single row containing the value 'X'.

select * from dual;


desc dual;

NULL:
Null is a unassigned value or unknown value or undefined value.

Null is not equal to zero.


Null is not equal to space
Null is not equal to underscore
Null is not equal to Null
Null is not equal to ''

0+Null Null
0-Null Null
0*Null Null
0/Null Null

SELECT *FROM Employees WHERE Email IS NULL;


SELECT *FROM Employees WHERE Email IS NOT NULL;

Null is always greater than any number because in ascending order Null comes last
and in decending order it comes first or it is maximum in ascending order & minimum
in decending order.

IN CONDITION

(i). IN condition is used to filter rows from a result set based on specified list
of values.
(ii).It is often used in the WHERE clause

department_id = 10,20,30

department_id IN (10,20,30)
department_id NOT IN (10,20,30)

Column_name IN('a','c','e') --FOR String

select * from employees where department_id IN (10,20,30);

(i). BETWEEN operator is used to filter rows from a result set based on specified
range of values.
(ii).It is often used in the WHERE clause

BETWEEN 10 AND 50;


NOT BETWEEN 10 AND 50;

SELECT first_name,employee_id,salary,department_id FROM employees WHERE salary


BETWEEN 10000 AND 15000;
SELECT first_name,employee_id,salary,department_id FROM employees WHERE salary NOT
BETWEEN 10000 AND 15000;

You might also like