Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Advance Java

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

Advance java:-

Web applications using Adv java:- (J2EE)


1.JDBC:-
Oracle basics:-
• In general we can develop two types of programs.
• Non persistence programming: non persistence programs are one in which result
of the program will be stored in the system memory temporarily.
• Persistence programming: persistence programs are one in which result of the
program will be stored in the system memory permanently.
• Persistence can be done in two ways
1. Using the files
2. Using database
Using the files:-
• Files are used to store the data permanently in a particular space on the desk.
• Files are having following limitations
• Files are used to store less amount of data.
• Files are providing no security.
• In the files the data will be stored sequentially thus manipulating the data in files
is not efficient.
• In order to eliminate the above limitations data base are introduced.
Using database:-
• Database is the collection of information related to a particular purpose or subject.
• In any database the data can be maintained & manipulated in the form of two
dimensional greeds called table, vertical greeds are called columns which represents
attribute or fields, horizontal greeds are nothing but rows which represents records or
tuples, collection of tuples are nothing but data.
• In simple words database is a collection of tables.

Sno sname scity pin


101 sai knl 518002

Rows: - record/tuple

Columns: -attribute/fields

2. DBMS: -
1. Database management system is a software or program which enables you to define the
structure to store the data.
2. Providing the great mechanism for manipulating the data.
3. Providing the security for the confidential data.
LIMITAIONS OF DBMS: -
• There is no referential integrity between two or more tables, thus there is a chance of
(getting) data redundancy issues.
• It doesn’t support client server architecture.
• It good for developing standalone applications.
• It is a single server.
• It providing less security.

Note: - In order to eliminate the limitations of DBSM Dr.E.F.COOD a softer expert belongs to
IBM in the year of 1970, he published 12 rules to market if any database vendors develop their
database by achieving those rules than those database will comes into RDBMS.
Ex: - oracle | sql server | MYSQL | DB2……………etc.
Advantages:-
• We can enforce the referential integrity between two or more tables.
• We can avoid data redundancy issues.
• It will support client server architecture.
• Good for developing any type of web applications.
• It is multiuser.
• It is providing good security.

SQL:-
• Structured query language.
• It is the standard for all RDBMS.
• It is a non-processual language, where we are writing the commands to maintain &
manipulate the data in the database objects.
• In SQL we can execute only operations at a time.
SQL*PLUS: -
• It is also a non-processual language.
• It is providing some set of commands.
• Which are using to control or coordinate oracle environment.
PL/SQL: -
• Processual structured query language.
• It is the extension of SQL.
• In PL/SQL we use to write the programs, in order to maintain & manipulate the data and
database object.
• In PL/SQL we can execute group of operations simultaneously, thus it increase
efficiency.
ORACLE: -
SQL COMMANDS: -
CREATE: -
• It is a DDL command (DATA DEFINATION LANGUAGE).
• It allows you to define the structure of the data with minimum of one column, maximum
of 1000 columns.
SYNTAX: - SQL>CREATE <TABLE> <TABLENAME>
(<COLUMNNAME> <DATATYPE> (SIZE),
<COLUMNNAME> <DATATYPE>(SIZE));
Example: - SQL >CREATE TABLE STUDENT (
SNO NUMBER(3),
SNAME VARCHAR(10),
SCITY VARCHAR(10);
SQL>SHOW USER: - It will display the current user name.
SQL>CL SCR: - It will clear the screen.
SQL>SELECT * FROM TAB;
It will display the object existed in the current user.
SQL>DESC <TABLENAME>
EX: - SQL>DESC STUDENT
It will display the description of the table such as column names, their data
types & their sizes.
ALTER: - It is a DDL command which enable you to make the modification in the table, which
is already define, such as
Adding a column or columns.
Changing the name of the columns.
We can drop a column or columns.
If you want to drop a column then we need to make use of the keyword column, but if you want
to drop more than one column, that does not required to use the keyword column, rather we need
to make use of column list in the parenthesis.
SYNTAX: - SQL>ALTER <TABLE> <TABLENAME>
ADD | MODIFY | DROP
(<COLUMNNAME> <DROPTYPE> (SIZE),………..);
Ex1: - SQL>ALTER TABLE STUDENT
ADD
(FNAME VARCHAR(10),
PIN NUMBER (6));
Ex2: - SQL>ALTER TABLE STUDENT
RENAME COLUMN
SNAME TO STU_NAME;
Ex3: - SQL>ALTER TABLE STUDENT
MODIFY
FNAME CHAR(20);
Ex4: - SQL>ALTER TABLE STUDENT
DROP COLUMN
SCITY
Ex5: - SQL>ALTER TABLE STUDENT
DROP
(FNAME, PIN);
TRUNCATE: -
• It is a DDL command, which enable you to remove all the records existed in the table in a
single shot.
• The records which are deleted by using the command TRUNCATE, those records will
not be taken back.
SYNTAX: -SQL>TRUNCATE <TABLE> <TABLENAME>
SQL>TRUNCATE TABLE STUDENT;
DROP: -
• It is also a DDL command, it will drop the table along with its records
SYNTAX: - SQL>DROP <TABLE> <TABLENAME>
SQL >DROP TABLE STUDENT;

INSERT: -
• It is a DML command (DATA MANIPULATING LAG)
• With the help of insert command we can set the data into specified columns or all column
in the table.
• If you want to insert the data into specified columns then it is recommended to specify
the columns similarly if you want to insert the data into all columns, does not require to
specify the column name, rather values order should be exactly some with order of the
column existed in the table.
• While inserting the data into character type or varchar type & data type then the values
should be enclosed with single (‘ ‘) quotations marks.
SYNTAX: - SQL>INSERT <INTO> <TABLENAME>
(<COLUMN1>, <COLUMN2>,……….<COLUMNN>)
VALUES
(VALUES1,VALUES2………….VALUES N);
Ex: - SQL>CREATE TABLE STUDENT(
SNO NUMBER(3),
SNAME VARCHAR(10),
SCITY VARCHAR(10));
Table created.
SQL>INSERT INTO STUDENT
(SNO , SCITY)
VALUES
(111, ‘HYD’);
RECREATED
SQL>INSERT INTO STUDENT
VALUES
(123 , ‘JAMES’ ‘USA’);
SELECT: -
• It is a DRL or DQL command (DATA QUERY LANGUAGE,DATA RETRIVED
LANGUAGE)
• It is used to read the data from the specified column are all the columns from the table.
• If you want to read the data from the specified columns then required to specify the
column names similarly, If you want to read the data from all the columns then doesn’t
require to specify the columns names, rather we need to make use of projection
operator(*).
• By the type of reading the data from the table you can change the order of the columns.
• If you want we can read the data from the table conditionally or unconditionally using
where clause.
• By using order by clause we can retrieve the data from the table in a sorting order.
• By using distinct clause we can eliminate duplicate values.
SYNTAX: - SQL>SELECT [DISTINCT] <COLUMNLIST>
FROM <TABLENAME>
[WHERE <CONDITION>]
[ORDER BY <COLUMN> [DESC]];
Ex: -SQL>SELECT ENAME FROM EMP;
SQL>SELECT ENAME, JOB FROM EMP;
SQL>SELECT * FROMEMP;
SQL>SET NUMWIDTH 5
SQL>SELECT ENAME, JOB, SAL, COMM, DEPTNO FROM EMP
Ex: - SQL>SELECT EMPNO, ENAME, JOB, SAL FROM EMP
WHERE ENAME =’SMITH’;
SQL>SELECT *FROM EMP
WHERE JOB =’SALESMAN’;
GROUP FUNCTIONS: -
• In general functions means which returns a value.
• But in oracle or in sql function are in two types.
• Single row functions
• Group functions
• Single row functions will take the data from a row manipulates and it will return the
values whereas group functions will take the data from multiple rows manipulates and it
will gives a value.
SUM(): - It will return the sum of values existed in the sum of column.
AVG(): - It will return avg values of the values existed in the particular column.
MIN(): - It will return the min values of the values existed in the particular column.
MAX(): - It will return max values of the values existed in the particular column.
COUNT(): - It will return no.of values are existed in the particular column.
Ex:- SQL>SELECT SUM(SAL)
AVG(SAL), MAX(SAL), MIN(SAL), COUNT(SAL)
FROM EMP;
GROUP BY: -It is a class of select statement it is used to group the similar rows in a table into
smaller partition.
SYNTAX: - SQL>SELECT [DISTICT] <COLUMNLIST>
FROM <TABLENAME>
[WHERE <CONDITION>]
[GROUP BY <COMDITION>]
ORDER BY <COLUMNNAMES>[DESC]];
Ex: - SQL>SELECT JOB, MIN(SAL), MAX(SAL), COUNT(SAL),
AVG(SAL) FROM EMP
WHERE JOB=’MANAGER’
GROUP BY JOB;
SQL>SELECT JOB, SUM(SAL) FROM EMP
GROUP BY JOB;
SQL>SELECT DEPTNO, SUM(SAL), AVG(SAL),COUNT(SAL)
FROM EMP WHERE DEPTNO=10 OR DEPTNO=30;
HANDALING NULL VALUES: -
• In oracle missing data or unauthorised or undefined values
• If you perform any arthematic expression on the null value the output remains null only.
• In order to handle the null values then we need to make use of NVL function.

You might also like