SQL
SQL
1.Char :- Char(Size)
Char datatype follows fix length memory allocation
we can put 2000 datatype(maximum)
If the length of the string is less than the set length, it is padded with extra
blank spaces to match the specified length
2.Varchar :- Varchar(size)
Varchar datatype follows not fix length memory allocation
same as 2000 datatype(max)
If the length of the string is less than the set length, it is stored as is without
any paddings
Varchar2 :- same as varchar untill 4000
3.Date :- DD-MMM-YYYY
4.Number :-Number datatye uses to represent are real with decimal point and real
number without a decimal point.
Number(Precision[,scale])
precision is uses to number of digit ,scale is number of decimal point
c)Data Query Language :-it is used to retrieved the data from the table
*>>Projections :- retrieving the data by selecting only columns
Syntax :- select distinct/expression/[alias]/astericks(*);
* :-
distinct :- select all values and remove duplicate values
expression :- it is the combination of both operators and operands
Alias :- alias name only to display the output
*>>Selection :-it is the process of retreiving the data by selecting both columns
and rows
Syntax :- select column/expression
from table_name
[where <condtion>;]
select claws :- selecting the column to the display
Operators in SQL :-
1.Arithmetic :- (+,-,*,/)
2.Concatination :- (||)
3.Comparision :- (=,!=,<>)
4.Logical :- (And,Or,Not)
5.Relational :- (>,<,<=,>=)
6.special :-
1.IN :- to check the data present in table
2.NOT IN
3.BETWEEN
4.NOT BETWEEN
5.IS :- to check the null value
6.IS NOT
7.LIKE SYNTAX :- COLUMN LIKE 'PATTERN-TO-MATCH'; '%' & '-' IS TWO
CHARACTERS TO MATCH PATTERN. '%' :- USED TO MATCH 0-N CHARACTER '-' :- USED TO
MATCH 1 CHARACTER
8.NOT LIKE
ESCAPE CHARACTER :- COLUMN NAME 'PATTERN'ESCAPE'ESCAPE_CHAR'
7.SUBQUERY OPERATORS :-
1.ALL :- IF ANY ONE VALUE IS NOT SATISFIED IT RETURNS FALSE.IF ALL VALUE IS
SATISFIED IT RETURNS TRUE.
2.ANY :- IF ANYONE VALUE IS SATISFIED IT RETURNS TRUE.(WE CANNT USE RELATIONAL AND
COMPARISION OPERATOR)
8.CO-RELATED SUBQUERY :-
1.EXISTS :- EXISTS OPERATOR RETURN TRUE IF SUBQUERY RETURNS OTHER THAN NULL
VALUE .IT IS A UNARY OPERATOR.
2.NOT EXISTS :- IF THE INNER QUERY RETURN NULL VALUE THAN IT WILL RETUERN SOME
OUTPUT AND VISE VERSA.
5.NESTED QUERY :- QUERY THE SUBQUERY RETURN INSIDE A RETURN SUBQUERY
d)Data Control language :- IT IS USED TO CONTROL THE DATA FLOW BETWEEN THE USES
1.GRANT :- SYNTAX :- GRANT SQL STATEMENTS/ALL ON TABLE_NAME TO USER_NAME
2.REVOKE :-WHEN WE GET BACK THE PERMISSION WE USE REVOKE
SYNTAX :- REVOKE SQL STATEMENTS/ALL ON TABLE_NAME TO USER_NAME;
e)Transaction Control Language :- It is used to control transaction on database
*>>Commit :- to save the transaction into a database
*>> Rollback :-
**>> PSUDO COLUMNS :- THIS ARE THE INVISIBLE COLUMN WHICH ARE PRESENT IN EVERY
TABLE
1.ROWID :-IT IS A UNIQUE ADDRESS GIVEN TO A RECORD AND IT WILL GET CREATE WHEN WE
INSERT THE DATA INTO A TABLE
2.ROW NUMBER :-THIS IS A SERIAL NUMBER GIVEN TO THE RECORDS.WHEN WE TRY DISPLAY THE
RECORDS THEN IT GENERATES SERIAL NUMBERS IN ROWNUM COLUMN.NOT USE > OPERATOR,USE
ONLY < OR <=