Anda di halaman 1dari 97

EX NO: 1 DATE:

AIM:

INTRODUCTION TO DBMS AND ORCALE

To study about DBMS and ORCALE DBMS: A database management system is essentially a collection of interrelated data and set of programs to access the data.

ORCALE:

A Collection Of Database System Support Single And Multiuser When data are stored in a computer file using a database management system such as FOXPRO,DBASE111 PLUS,ORCALE. The file is called database file.

RDBMS:

Acronym for related database management system. It is based on relational theory in mathematics. Some of the IT industry is based on RDBMS.

CONCEPT OF ORCALE:

Sybase Informax

INTRODUCTION OF ORCALE: Oracle is a DBMS package developed by the ORCALE corporation. Various versions are ORCALE and ORCALE8 Oracle is an object relational DBMS package. It supports both objects oriented and relational database concepts. A table is s unit of storage which holds in the form of rows and columns.

Collection of tables with their interrelation could be termed as database.

ORCALE OFFER CONCURRENT ACCESS TO USERS: It supports client server technology. The individual table can have upto 1000 columns.

TOOLS OF ORCALE: SQL/PLUS PL/SQL Forms Reports.

SQL/PLUS: Structured query language is used for accessing and manipulating the database. Through SQL/PLUS we can store, retrieve edit SQL command. To communicate with the database, SQL supports the following languages,

1. DATA DEFINITION LANGUAGE(DDL): Create, alter, drop, grant commands. 2. DATA MANIPULATION LANGHUAGE(DML): Insert, select, delete, update commands. 3. TRANSACTION CONTROL LANGUAGE: Commit, rollback commands. ADVANTAGE OF SQL: Simple commands Non procedural language.

ORCALE INTERNAL DATATYPE: In order to create a table,we need to specify a datatype to undivided columns.

1. CHARACTER DATATYPE:

This datatype is used to fix length character string. The column length may vary from 1-55 bytes. 2. VARCHAR DATATYPE: It supports variable length character, size is 1-2000 bytes. 3. LONG DATATYPE: It is used to store the character, maximum size is 2GB.

NUMERIC DATATYPE: This can store the positive negative numbers,zero,fixed,floating point numbers. The precision is 38.

DATE DATATYPE: This is used to store the date. The default format is dd-mm-yyyy.

RAW DATATYPE: This is used to store the binary data.

LONG RAW DATATYPE: This is used to store the binary data of variable length.

RESULT: Thus we have studied about DBMS and ORCALE.

EX. NO: 2(a) DATE: DATA DEFINITION AND TABLE CREATION AIM To execute and verify the Basic SQL commands. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table STEP 4: Execute different Commands and extract information from the table. STEP 5: Stop SQL COMMANDS 1. COMMAND NAME: CREATE COMMAND DESCRIPTION: CREATE command is used to create objects in database CREATE TABLE table_name ( Column_name1 datatype, Column_name2 datatype, .. ); 2. COMMAND NAME: ALTER COMMAND DESCRIPTION: ALTER command is used to alter the structure of database. To add a column in a table, ALTER TABLE table_name ADD column_name data type; 3. COMMAND NAME: DROP COMMAND DESCRIPTION: DROP command is used to delete the object from database. DROP TABLE table_name; 4. COMMAND NAME: TRUNCATE COMMAND DESCRIPTION: TRUNCATE command is used to remove all the records in the table including the space allocated for the table. TRUNCATE TABLE table_name

EXERCISE: 1. Create a table employee with fields employee name,employee no,dept name,dept no, and date of joining and display the table. 2. To the employee table add a new field named employee salary and display it. 3. Alter the table employee by changing the data type of salary from number to varchar. 4. Alter the table employee by dropping the field salary and display it. 5. Truncate the table employee and drop it. 6. Drop the employee table.

OUTPUT: 1.CREATION OF TABLE -------------------------------SQL> create table employee ( Employee_name varchar2(10),employee_nonumber(8), dept_name varchar2(10),dept_no number (5),date_of_join date); Table created. TABLE DESCRIPTION ------------------------------SQL> desc employee; Name EMPLOYEE_NAME EMPLOYEE_NO DEPT_NAME DEPT_NO DATE_OF_JOIN INSERTION OF TABLE VALUES -------------------------------------------SQL> insert into employee values ('Vijay',345,'CSE',21,'21-jun-2006'); 1 row created. SQL> insert into employee values ('Raj',98,'IT',22,'30-sep-2006'); 1 row created. SQL> insert into employee values ('Giri',100,'CSE',67,'14-nov-1981'); Null? Type VARCHAR2(10) NUMBER(8) VARCHAR2(10) NUMBER(5) DATE ------------------------------- -------- ------------------------

1 row created. SQL> insert into employee values('Vishva',128, 'ECE',87,'25-dec-2006'); 1 row created. SQL> insert into employee values ('Ravi',124,'ECE',89,'15-jun-2005'); 1 row created. SELECTION OR DISPLAY OF TABLE ---------------------------------------------------SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME -----------------Vijay Raj Giri Vishva Ravi -------------------- ----------------345 98 100 128 124 CSE IT CSE ECE ECE DEPT_NO DATE_OF_J ------------ ---------------------------21 22 67 87 89 21-JUN-06 30-SEP-06 14-NOV-81 25-DEC-06 15-JUN-05

UPDATE OF TABLE VALUES ----------------------------------------SQL> update employee set employee_no=300 where dept_no=67; 1 row updated. SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME -----------------Vijay Raj Giri Vishva Ravi -------------------- ----------------345 98 300 128 124 CSE IT CSE ECE ECE DEPT_NO DATE_OF_J ------------ --------------21 22 67 87 89 21-JUN-06 30-SEP-06 14-NOV-81 25-DEC-06 15-JUN-05;

2. ALTERING TABLE: SQL> alter table employee add ( salary number); Table altered. SQL> select * from employee;

EMPLOYEE_N EMPLOYEE_NO DEPT_NAME DEPT_NO DATE_OF_J SALARY ------------------- --------------------- ------------------ ------------- --------------- ----------Raj Giri Vishva 1 row updated. SQL> update employee set salary = 90 where employee_no=100; 1 row updated. SQL> update employee set salary = 134 where employee_no=128; 1 row updated. SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME DEPT_NODATE_OF_J Raj Giri Vishva 98 100 128 IT CSE ECE 22 67 87 30-SEP-06 14-NOV-81 25-DEC-06 SALARY 100 90 134 98 100 128 IT CSE ECE 22 67 87 30-SEP-06 14-NOV-81 25-DEC-06

SQL> update employee set salary = 100 where employee_no=98;

---------- ----------- -------------------- --------- --------- -------------- ---------------- -------------

3. MODIFYING THE COLUMN OF EMPLOYEE TABLE ----------------------------------------------------------------------SQL> alter table employee modify ( salary varchar2(10)); Table altered. SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME DEPT_NO DATE_OF_J ------------------- --------------------- ---------------Raj Giri Vishva 98 100 128 IT CSE ECE SALARY

------------- ---------------- -----------22 67 87 30-SEP-06 14-NOV-81 25-DEC-06

SQL> update employee set salary ='90'where employee_no=100; 1 row updated. SQL> update employee set salary ='134' where employee_no=128; 1 row updated. SQL> update employee set salary ='100'where employee_no=98; 1 row updated. SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME Raj Giri Vishva 98 100 128 IT CSE ECE DEPT_NO DATE_OF_J SALARY 22 67 87 30-SEP-06 14-NOV-81 25-DEC-06 100 90 134 -------------------- --------------------- ------------------- ------------- ---------------- -----------

4. DELETION OF TABLE VALUES -------------------------------------------SQL>alter table employee drop column salary; Table altered SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME ------------------- --------------------- -----------------Vijay Raj Giri Vishva Ravi 345 98 100 128 124 CSE IT CSE ECE ECE DEPT_NO DATE_OF_J ------------- ---------------21 22 67 87 89 21-JUN-06 30-SEP-06 14-NOV-81 25-DEC-06 15-JUN-05

SQL> delete from employee where employee_no >344; 1 row deleted. SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME Raj 98 IT DEPT_NO DATE_OF_J 22 30-SEP-06

------------------- ---------------------- ------------------ --------------- ----------------

Giri Vishva Ravi

100 128 124

CSE ECE ECE

67 87 89

14-NOV-81 25-DEC-06 15-JUN-05

SQL> delete from employee where employee_no =124; 1 row deleted. SQL> select * from employee; EMPLOYEE_N EMPLOYEE_NO DEPT_NAME Raj Giri Vishva 98 100 128 IT CSE ECE DEPT_NO DATE_OF_J 22 67 87 30-SEP-06 14-NOV-81 25-DEC-06 ------------------- --------------------- ------------------ -------------- ----------------

5. TRUNCATION OF TABLE --------------------------------------------SQL> truncate table employee; Table truncated. SQL> select * from employee; no rows selected 6.DROPPING OF TABLE ------------------------------SQL> drop table employee; Table dropped.

RESULT: Thus the DDL commands was executed successfully.

EX. NO: 2(b) DATE: AIM To execute and verify the Special SQL commands. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table STEP 4: Execute different Commands and extract information from the table. STEP 5: Stop CONSTRAINTS: A constraint is a property assigned to a column or the set of columns in a table that prevents certain types of inconsistent data values from being placed in the column. Constraint are used to enforce the data integrity. This ensures the accuracy and reliability of the data in the database. Microsoft SQL server supports the following constraint: 1. 2. 3. 4. 5. 6. NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY CHECK DEFAULT CONSTRAINTS

SQL NOT NULL CONSTRAINT The NOT NULL constraint enforces a column to NOT accept NULL values. The NOT NULL constraint enforces a field to always contain a value. This means that you cannot insert a new record or update a record without adding a value to this field. CREATE TABLE student ( Rollno number(3) NOT NULL, Name varchar(20) NOT NULL, Address varchar(20), City varchar(20) ); SQL UNIQUE CONSTRAINT:

The UNIQUE constraint uniquely identifies each record in a database table. The UNIQUE and PRIMARY KEY constraints both provide a guarantee for uniqueness for a column or set of columns. A PRIMARY KEY constraint automatically has a UNIQUE constraint defined on it. Note that you can have many UNIQUE constraints per table,but only one PRIMARY KEY constraint per table. CREATE TABLE student ( Rollno number(2) NOT NULL, Name varchar(20) NOT NULL, Address varchar(20), City varchar(20), UNIQUE(Rollno) ); SQL PRIMARY KEY CONSTRAINT: The PRIMARY KEY constraint uniquely identifies each record in a database table. Primary keys must contain unique values. A primary key column cannot contain NULL values. Each table should have a primary key, and each table can have only ONE primary key. CREATE TABLE student ( Rollno Number(2) NOT NULL, Name Varchar(20) NOT NULL, Address Varchar(20), City varchar(20), PRIMARY KEY(ROLLNO), )

QUERIES: 1.SET THE PRIMARY KEY AND CHECK CONSTRAINTS FOR THE STUDENT TABLE: SQL> create table student_table(regno number(5) primary key,mark1 number(5) check(mark1>80));

SQL> insert into student_table values(102,87); SQL> select * from student_table; SQL> insert into student_table values(102,76);
2.SET THE FOREIGN KEY FOR THE STUDENT_TABLE AND MARK TABLE:

SQL> create table mark_table(regno number(5) constraint fk_regno references student_table(regno)); SQL> insert into mark_table values(101); SQL> insert into mark_table values(102); SQL> delete from student_table where regno=101; SQL> delete from student_table where regno=102;

3.DROP THE CONSTRAINTS FROM THE TABLE:

SQL> alter table mark_table drop constraint fk_regno; SQL> insert into mark_table values(104); SQL> select * from mark_table;
4.SET UNIQUE AND NOT NULL CONDITIONS CONSTRAINTS FOR THE STUDENT OR ANY OTHER TABLE:

SQL> create table stud(regno number(5) constraint pk_no unique,mark number(5) constraint mar_no not null); SQL> insert into stud values(1,90); SQL> insert into stud values(1,99); SQL> insert into stud values(2,NULL); SQL> select * from stud;

RESULT: Thus the DDL commands and constraint are executed and the output verified successfully.

EX. NO: 3 DATE: INSERT, SELECT COMMANDS, UPDATE & DELETE COMMANDS

AIM To execute and verify the Special SQL commands. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table STEP 4: Execute different Commands and extract information from the table. STEP 5: Stop OPERATIONS: 1. INSERT COMMAND The insert command is used to add one or more rows to a table. The values are separated by commands and the datatype characters. And the data are enclosed in apostrops. The value must be enclosed in the same order as they are defined in the table. SYNTAX: Insert<tablename>values(list of data); Insert into<tablename>(&alter); 2. UPDATE COMMAND: This command is used to change and modify value in a table. This command is used to update selected set of rows from a table. SYNTAX: (to update all rows) Update<tablename>set alter=value; SYNTAX: (to update selected rows) Update<tablename>set<columnname>=value where<condition>;

3. DELETE COMMAND This command is used to delete all the rows from a table or do select rows from the table. SYNTAX: (delete all rows of table) Delete from<tablename>; SYNTAX: (to delete selected rows) Delete from<tablename>where<condition>; 4. RENAME COMMAND It is used to rename the tables. SYNTAX: Rename<old tablename>to<new tablename> 5. SELECT COMMAND This To Used to perform a query. The query is request for information. SYNTAX: Select column name from<tablename>; Selecting distinct rows to prevent selection of duplicated rows we use the command SYNTAX: Select command with var clause; To select a specific rows from a table we include a where clause in the selected statement. SYNTAX: Select distinct column name from<tablename>where<condition>;

EXERCISE1: 1.Create table student with fields ROLLNO,NAME,ADDRESS,GENDER,DOB,DOJ,DEPTNO and FEES 2.Create a table department with DEPTNO,DEPTNAME. 3.Create a table mark with ROLLNO,SUB1,SUB2,SUB3. 4.Insert the values in to the tables and describe the tables. 5.Change the address of the student nisha to trichy. 6.Change the fees amount of rollno 2 to old fees+10%. 7.Change the doj of the student with rollno 3 to 22-july-2012. 8.Decrement the fees amount for the student ammu and raju by Rs/-1000. 9.Increase the fees of all the student manoj from table. 10. Display all the records from the table student. 11. Rename the student table to STUD.

EXERCISE:2 1.List all the rollno and name of the students. 2.Display the rollno,address,DOB,DOJ for the student rollno greater than 2. 3.Display the names of the student who paid the fees more than 5000. 4.Display the details of the students where rollno is greater than 2. 5.Display only the address from the student table. 6.Display the details of the student in ascending order by the rollno. 7.Display the details of all the female students. 8.Display the details of the students where deptno is greater than 2 in descending order by their fees. 9.Display the details of the students whose name starts with R. 10. Display the details of the students whose name has the second letter M. 11. Display the details of student from Madurai and nagercoil. 12. Display the details of the students other than the details of the students from nagercoil.

13. Display the details of the student whose fees is in between 4000 and 8000. 14. List all the student who belongs to Madurai or nagercoil. 15. List the details of the student whose rollno is not in the range from 2-5. 16. Display only the first three records from the student table. 17. Display the deptname from the department table. 18. Display the marks for the student with rollno 2. 19. Display only the marks for sub1. EXERCISE:3 1.Display the name,rollno and dept of all students. 2.Display the name,dept of the students who had secured more than 200 marks. 3.Display the name,dept and total marks of the student who has passed in all subjects. 4.Find the number of students passed in each dept. 5.Display the name,dept of the student who has secured more than the marks secured by the student ammu. 6.Display the name and dept and marks of the student failed only in one subject. 7.Give the names and dept of the student secured more than 75%. 8.Arrange the names of male and female students and arrange the students according to the gender. 9.Which dept has the maximum number of students.

OUTPUT:EXERCISE-1 SQL> create table student(rollno number(5),name varchar2(15),address varchar2(20),gender char(4),dob date,doj date,deptno number(2),fees number(7)); Table created. SQL> insert into student values('&rollno','&name','&address','&gender','&dob','&doj','&deptno','&fees'); Enter value for rollno: 1 Enter value for name: Ammu Enter value for address: nagercoil Enter value for gender: f

Enter value for dob: 24-may-1987 Enter value for doj: 23-june-2010 Enter value for deptno: 2 Enter value for fees: 6000

1 row created.

SQL> / Enter value for rollno: 2 Enter value for name: Brindha Enter value for address: nagercoil Enter value for gender: f Enter value for dob: 22-july-1988 Enter value for doj: 12-may-2010 Enter value for deptno: 2 Enter value for fees: 6000

1 row created.

SQL> / Enter value for rollno: 3 Enter value for name: Nisha Enter value for address: madurai Enter value for gender: f Enter value for dob: 10-june-1987 Enter value for doj: 24-sep-2010 Enter value for deptno: 1 Enter value for fees: 7000

1 row created.

SQL> / Enter value for rollno: 4 Enter value for name: raju

Enter value for address: madurai Enter value for gender: m Enter value for dob: 31-dec-1987 Enter value for doj: 24-june-2012 Enter value for deptno: 2 Enter value for fees: 7000

1 row created.

SQL> / Enter value for rollno: 5 Enter value for name: sankar Enter value for address: tirunelveli Enter value for gender: m Enter value for dob: 28-feb-1987 Enter value for doj: 22-june-2010 Enter value for deptno: 3 Enter value for fees: 6000

1 row created.

SQL> select * from student;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu 2 Brindha 3 Nisha 4 raju 5 sankar nagercoil nagercoil madurai madurai tirunelveli f 24-MAY-87 23-JUN-10 f 22-JUL-88 12-MAY-10 f m m 10-JUN-87 24-SEP-10 31-DEC-87 24-JUN-12 28-FEB-87 22-JUN-10 2 2 1 2 3 6000 6000 7000 7000 6000

SQL> create table department(deptno number(2),deptname char(5)); Table created.

SQL> insert into department values('&deptno','&deptname'); Enter value for deptno: 1 Enter value for deptname: cse 1 row created.

SQL> / Enter value for deptno: 2 Enter value for deptname: ECE 1 row created.

SQL> / Enter value for deptno: 3 Enter value for deptname: Civil 1 row created.

SQL> / Enter value for deptno: 4 Enter value for deptname: EEE 1 row created.

SQL> select * from department;

DEPTNO DEPTN --------- ----1 cse 2 ECE 3 Civil 4 EEE

SQL> create table mark(rollno number(5),sub1 number(3),sub2 number(3 Table created.

SQL> insert into mark values('&rollno','&sub1','&sub2','&sub3'); Enter value for rollno: 1 Enter value for sub1: 90 Enter value for sub2: 80 Enter value for sub3: 60 1 row created.

SQL> / Enter value for rollno: 40 Enter value for sub1: 50 Enter value for sub2: 63 Enter value for sub3: 50 1 row created.

SQL> / Enter value for rollno: 2 Enter value for sub1: 88 Enter value for sub2: 50 Enter value for sub3: 40 1 row created.

SQL> / Enter value for rollno: 3 Enter value for sub1: 26 Enter value for sub2: 69 Enter value for sub3: 41 1 row created.

SQL> / Enter value for rollno: 4 Enter value for sub1: 78 Enter value for sub2: 90 Enter value for sub3: 96 1 row created.

SQL> / Enter value for rollno: 5 Enter value for sub1: 18 Enter value for sub2: 29 Enter value for sub3: 06 1 row created.

SQL> select * from mark;

ROLLNO

SUB1

SUB2

SUB3

--------- --------- --------- --------1 40 2 3 4 5 90 50 88 26 78 18 80 63 50 69 90 29 60 50 40 41 96 6

6 rows selected.

SQL> rename student to stud; Table renamed.

SQL> select * from stud;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu 2 Brindha 3 Nisha 4 raju nagercoil nagercoil madurai madurai f 24-MAY-87 23-JUN-10 2 2 1 2 6000 6000 7000 7000

f 22-JUL-88 12-MAY-10 f m 10-JUN-87 24-SEP-10 31-DEC-87 24-JUN-12

5 sankar

tirunelveli

28-FEB-87 22-JUN-10

6000

EXERCISE-2

SQL> select rollno,name from stud;

ROLLNO NAME --------- --------------1 Ammu 2 Brindha 3 Nisha 4 raju 5 sankar

SQL> select rollno,address,dob,doj from stud where name='raju';

ROLLNO ADDRESS

DOB

DOJ

--------- -------------------- --------- --------4 madurai 31-DEC-87 24-JUN-12

SQL> select name from stud where fees>6000;

NAME --------------Nisha raju

SQL> select * from stud where rollno>2;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------3 Nisha 4 raju madurai madurai f m 10-JUN-87 24-SEP-10 31-DEC-87 24-JUN-12 1 2 7000 7000

5 sankar

tirunelveli

28-FEB-87 22-JUN-10

6000

SQL> select distinct address from stud;

ADDRESS -------------------madurai nagercoil tirunelveli

SQL> select * from stud order by rollno;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu 2 Brindha 3 Nisha 4 raju 5 sankar nagercoil nagercoil madurai madurai tirunelveli m m f 24-MAY-87 23-JUN-10 f 22-JUL-88 12-MAY-10 f 10-JUN-87 24-SEP-10 31-DEC-87 24-JUN-12 28-FEB-87 22-JUN-10 2 3 2 2 1 6000 6000 7000 7000 6000

SQL> select * from stud where gender='f';

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu 2 Brindha 3 Nisha nagercoil nagercoil madurai f 24-MAY-87 23-JUN-10 f 22-JUL-88 12-MAY-10 f 10-JUN-87 24-SEP-10 2 2 1 6000 6000 7000

SQL> select * from stud where deptno>2 order by fees;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------5 sankar tirunelveli m 28-FEB-87 22-JUN-10 3 6000

SQL> select * from stud where name like'r%';

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------4 raju madurai m 31-DEC-87 24-JUN-12 2 7000

SQL> select * from stud where name like'_m%';

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu nagercoil f 24-MAY-87 23-JUN-10 2 6000

SQL> select * from stud where address='nagercoil' or address='madurai';

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu 2 Brindha 3 Nisha 4 raju nagercoil nagercoil madurai madurai f 24-MAY-87 23-JUN-10 f 22-JUL-88 12-MAY-10 f m 10-JUN-87 24-SEP-10 31-DEC-87 24-JUN-12 1 2 2 2 6000 6000 7000 7000

SQL> select * from stud where address not in('nagercoil');

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------3 Nisha 4 raju madurai madurai f m 10-JUN-87 24-SEP-10 31-DEC-87 24-JUN-12 1 2 7000 7000

5 sankar

tirunelveli

28-FEB-87 22-JUN-10

6000

SQL> select * from stud where fees between 50000 and 8000;

no rows selected

SQL> select * from stud where fees between 5000 and 8000;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu 2 Brindha 3 Nisha 4 raju 5 sankar nagercoil nagercoil madurai madurai tirunelveli f 24-MAY-87 23-JUN-10 f 22-JUL-88 12-MAY-10 f m m 10-JUN-87 24-SEP-10 31-DEC-87 24-JUN-12 28-FEB-87 22-JUN-10 2 2 1 2 3 6000 6000 7000 7000 6000

SQL> select name from stud where address='chennai' or address='nagercoil';

NAME --------------Ammu Brindha

SQL> select * from stud where rollno<2 or rollno>5;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu nagercoil f 24-MAY-87 23-JUN-10 2 6000

SQL> select * from stud where rownum<=3;

ROLLNO NAME FEES

ADDRESS

GEND DOB

DOJ

DEPTNO

--------- --------------- -------------------- ---- --------- --------- --------- --------1 Ammu 2 Brindha 3 Nisha nagercoil nagercoil madurai f 24-MAY-87 23-JUN-10 f 22-JUL-88 12-MAY-10 f 10-JUN-87 24-SEP-10 1 2 2 6000 6000 7000

SQL> select deptname from department; DEPTN ----cse ECE Civil EEE

SQL> select sub1,sub2,sub3 from mark where rollno=2;

SUB1

SUB2

SUB3

--------- --------- --------88 50 40

SQL> select sub1 from mark; SUB1 --------90 50 88 26 78 18

6 rows selected.

EXERCISE-3

SQL> select name,rollno,deptname from stud,department where stud.deptno=department.deptno;

NAME

ROLLNO DEPTN

--------------- --------- ----Nisha Ammu raju Brindha sankar 3 cse 1 ECE 4 ECE 2 ECE 5 Civil

SQL> select name,deptname from stud,department,mark where((sub1+sub2+sub3)>200 and stud.deptno=department.deptno and stud.rollno=mark.rollno);

NAME

DEPTN

--------------- ----Ammu raju ECE ECE

SQL> select name,deptname,(sub1+sub2+sub3) as total from stud,department,mark where stud.deptno=department.deptno and stud.rollno=mark.rollno and sub1>49 and sub2>49 and sub3>49;

NAME

DEPTN

TOTAL

--------------- ----- --------Ammu raju ECE ECE 230 264

SQL> select name,deptname,(sub1+sub2+sub3) as total from stud,department,mark where stud.deptno=department.deptno and stud.rollno=mark.rollno and sub1>49 and sub2>49 and sub3>49;

NAME

DEPTN

TOTAL

--------------- ----- --------Ammu raju ECE ECE 230 264

SQL> select deptname,count(*) from stud,department,mark where(sub1>=50 and sub2>50 and sub3>50) and stud.deptno=department.deptno and stud.rollno=mark.rollno group by deptname;

DEPTN COUNT(*) ----- --------ECE 2

SQL> select name,deptname from mark,stud,department where stud.rollno=mark.rollno and stud.deptno=department.deptno and (sub1+sub2+sub3)>(select sub1+sub2+sub3 from mark,stud where stud.rollno=mark.rollno and name='nisha');

no rows selected

SQL> select name,deptname,sub1,sub2,sub3 from stud,department,mark where stud.rollno=mark.rollno and stud.deptno=department.deptno and ((sub1<50 and sub2>49 and sub3>49) or(sub1>49 and sub2<50 and sub3>49)or(sub1>49 and sub2>49 and sub3<50));

NAME

DEPTN

SUB1

SUB2

SUB3

--------------- ----- --------- --------- --------Brindha ECE 88 50 40

SQL> select name,deptname from stud,mark,department where stud.deptno=department.deptno and stud.rollno=mark.rollno and(sub1+sub2+sub3)/3>75;

NAME

DEPTN

--------------- ----Ammu raju ECE ECE

SQL> select name,deptname from mark,stud,department where stud.deptno=department.deptno and stud.rollno=mark.rollno order by sub1;

NAME

DEPTN

--------------- ----sankar Nisha raju Brindha Ammu Civil cse ECE ECE ECE

SQL> select distinct gender,count(8) from stud group by gender;

GEND COUNT(8) ---- --------f m 3 2

RESULT: Thus the DML and DDL commands in RDBMS were studied and output was verified successfully.

EX. NO: 3(b) DATE: AIM: To study and work with functions in Orcale. It can be classified into five categories. 1. 2. 3. 4. 5. Numeric functions Character functions Conversion functions Date functions Group fuinctions. FUNCTIONS IN ORCALE

NUMERIC FUNCTIONS: It accept numeric input and return numeric values as the output. 1. Abs(n) It return the absolute value of n. 2. Cell(n) It return the nearest higher integer value. 3. Floor(n) It return the nearest lowest integer value 4. Power(m,n) It return the value of nth power of m. 5. Mod(m,n) It return the rounded value depending on the value of n. 6. Round(m,n) It return the rounded value depending on the value of n. 7. Trunc(m,n) It return the truncate value depending on the value of n. 8. Sqrt(n) It return the square root of n.

CHARACTER: This function accepts the character input and return either character or number value. 1. Initcap(string) It return the word by capitalizing the first character.

2. Lower(string) It return the given word by changing all characters to lowercase. 3. Itrim(string,set) It return the left part of the word depending upon the string. 4. Upper(string) It return the given word by changing all the character to uppercase. 5. Rtrim(string,set) It truncate the right part of the word depending on the string. 6. Substr(string) It return the position of the word by depending on the value of m,n where m is the starting position of the word and n is the total number of characters. 7. Replace(string,search string,replace string) It search and replace the position of the word. 8. Length(string) It return the total number of characters in the word including the blank space. 9. Ipad(string,n,char) It files the left position of the string by the given character char depending upon the value ofn. 10. Concatenation operator This symbol is used to concatenate to separate strings.

CONVERSION In this converts a value from one datatype to another. 1. To char This function converts the number of datatypes DATA datatype to character datatype tmt is a format model. 2. To date DATE: 1. Add months(d,n) This function date return a date after adding a specified data with a specified number of months where d is the date and n represents the number of months. 2. Last day(d) It return the date corresponding to last day of the month.

3. Months between(d1,d2) It return the number of months between two dates 4. Next day(d.day) It return the date of first week day, name, day. This is after the date name by d. GROUP: It return the result based of rows. 1. Avg(01-name) It returns the average value of column name. 2. Max(01-name) It returns the highest value in a column. 3. Min(01-name) It returns the lowest value in the column. 4. Sum(01-name) It returns summerisation of the column. 5. Count(01-name) It counts the number of the values present in the column without including null.

EXERCISE: 1. Find the total number of students. 2. Find out the total number of male students. 3. Find out the total number of students from nagercoil. 4. Find the average and total fees remitted by all students. 5. Display the name in lowercase and address in uppercase for all the students. 6. Display the name by capitalizing the first letter of the each name and the square root of the roll number of the male students. 7. Display the letter from 1-3 of the students name and the last three letter of each address. 8. Display only the names by filling the right blank spaces by* symbol up to eight characters of all female students. 9. Display only the fees of the students. 10. Display the round values for the fees of the students whose fee is greater than 2000 and less than 8000. 11. Display by removing the string coil from the address of all nagercoil students.

12. Display the name by replacing the character a byc for all students with rollno greater than 2 13. Find the length of address for all male students. 14. Display the DOJ of the students with department number 4 in the following format.[12/feb/2004]. 15. Find the date 15th days after todays date. 16. Display the fees of the student with department number. 17. Find your age using months between function. 18. Display the day of next years current date. 19. Display todays date. 20. List the name, age of the student where name start with A. 21. Display the names of the students joined during the month September. 22. What is the average age of the male students. 23. Display the names of the students whose name has more than three characters. 24. Display the details of the students in the following the fees of the NAME is FEES.

OUTPUT: SQL> select count(name)as noofstud from stud; NOOFSTUD --------5 SQL> select count(name)as noofstud from stud where gender='m'; NOOFSTUD --------2 SQL> select count(name)as noofstud from stud where address='nagercoil'; NOOFSTUD --------2 SQL> select sum(fees),avg(fees) from stud; SUM(FEES) AVG(FEES) --------- --------32000 6400

SQL> select lower(name),upper(address)from stud; LOWER(NAME) UPPER(ADDRESS) --------------- -------------------ammu NAGERCOIL brindha NAGERCOIL nisha MADURAI raju MADURAI sankar TIRUNELVELI SQL> select initcap(name),sqrt(rollno)from stud where gender='f'; INITCAP(NAME) SQRT(ROLLNO) --------------- -----------Ammu 1 Brindha 1.4142136 Nisha 1.7320508 SQL> select substr(name,1,3)"name",substr(address,-3,3)"address"from stud; nam add --- --Amm oil Bri oil Nis rai raj rai san eli SQL> select rpad(name,8,'*')from stud where gender='f'; RPAD(NAM -------Ammu**** Brindha* Nisha*** SQL> select fees from stud; FEES --------6000 6000 7000 7000 6000 SQL> select round(fees)from stud where fees>10000 and fees>5000; no rows selected

SQL> select round(fees)from stud where fees>4000 and fees>8000; no rows selected SQL> select rtrim(address,'coil')from stud where address='nagercoil'; RTRIM(ADDRESS,'COIL' -------------------nager nager SQL> select replace(name,'m','c')from stud where rollno>1; REPLACE(NAME,'M --------------Brindha Nisha raju sankar SQL> select length(address)from stud where gender='m'; LENGTH(ADDRESS) --------------7 11 SQL> select to_date(doj,'dd/mm/yyyy')"dateofjoining"from stud where deptno=2; dateofjoi --------23-JUN-10 12-MAY-10 24-JUN-12 SQL> select sysdate+15"date"from stud; date --------17-APR-12 17-APR-12 17-APR-12 17-APR-12 17-APR-12 SQL> select fees,deptno from stud; FEES DEPTNO --------- --------6000 2

6000 7000 7000 6000

2 1 2 3

SQL> select months_between(sysdate,'24-may-1987')/12"age" from dual; age --------24.859258 SQL> elect to_char(add_months(sysdate,12),'day')from dual; unknown command beginning "elect to_c..." - rest of line ignored. SQL> select to_char(add_months(sysdate,12),'day')from dual; TO_CHAR(A --------tuesday SQL> select sysdate from dual; SYSDATE --------02-APR-12 SQL> select name,round(months_between(sysdate,dob)/12)from stud where name like 'a%'; no rows selected SQL> select name from stud where doj like '%june%'; no rows selected SQL> select name from stud where doj like '%may%'; no rows selected SQL> select avg(months_between(sysdate,dob)/12)from stud where gender='m'; AVG(MONTHS_BETWEEN(SYSDATE,DOB)/12) ----------------------------------24.677815 SQL> select name from stud where length(name)>3; NAME --------------Ammu Brindha Nisha

raju sankar SQL> select 'THE FEES OF'||name||'IS'||fees from stud; 'THEFEESOF'||NAME||'IS'||FEES -------------------------------------------------------------------THE FEES OFAmmuIS6000 THE FEES OFBrindhaIS6000 THE FEES OFNishaIS7000 THE FEES OFrajuIS7000 THE FEES OFsankarIS6000

RESULT: This to study and work with functions in oracle is done and the output was verified.

EX. NO: 4 DATE: NESTED QUERIES & JOIN QUERIES

AIM To execute and verify the SQL commands using nested queries and Join queries. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table STEP 4: Execute different Commands and extract information from the table. STEP 5: Stop JOIN QUERIES: Set operations combine the result of two queries into a single one. The operations are 1. Union 2. Union all 3. Intersect 4. Minus UNION: These operations returns all distinct rows selected by either query. SYNTAX: (select *from table name1)union(select *from table name2); UNION ALL: This returns all rows selected by either including duplicates. SYNTAX: (select *from table name1)union all(select *from table name2); INTERSECT: This returns only rows that are common to both queries. SYNTAX: (select *from table name1)intersect(select *from table name2);

MINUS: This returns all distinct rows selected only by the first query and not by the second. SYNTAX: (select 8from table name1)minus(select *from table name2); USE: The purpose of a join is to combine the data spread across tables. SYNTAX: Select columns from tale1, table2 where logical expression;

JOIN QUERY QUESTIONS: 1. Create table ticket details 2. Select distinct ticket number from both ticket header and ticket detail. 3. Select all ticket numbers from ticket header and ticket detail. 4. Select only the common ticket number that are present in ticket header and ticket detail. 5. Select distinct ticket number from ticket header and not in ticket detail using both the tables. 6. Select rows from ticket header such that route ids are less than the ticket numbers. 7. Select all rows from ticket header and only matching rows from ticket detail. 8. Select distinct ticket number from ticket header and ticket detail. 9. Select all tno from ticket header and ticket detail. 10. Select common ticket numbers that are present in ticket header and ticket detail.

NESTED QUERIES: 1. Select rows from ticket detail such that the ticket numbers are greater than any ticket number in ticket header where the id is 01. 2. Select rows from ticket header such that the ticket header such that the ticket numbers are greater than all ticket number in ticket detail where name character.

OUTPUT: JOIN QUERIES: SQL> create table ticketdetail(tno number(7),name varchar2(20),sex char(1),age number(3),fare number (5,2)); Table created.

SQL> insert into ticketdetail values('&tno','&name','&sex','&age','&fare'); Enter value for tno: 01 Enter value for name: charu Enter value for sex: f Enter value for age: 24 Enter value for fare: 14 old 1: insert into ticketdetail values('&tno','&name','&sex','&age','&fare') new 1: insert into ticketdetail values('01','charu','f','24','14') 1 row created.

SQL> / Enter value for tno: 02 Enter value for name: latha Enter value for sex: f Enter value for age: 10 Enter value for fare: 15 old 1: insert into ticketdetail values('&tno','&name','&sex','&age','&fare') new 1: insert into ticketdetail values('02','latha','f','10','15') 1 row created.

SQL> / Enter value for tno: 03 Enter value for name: anand Enter value for sex: m Enter value for age: 28 Enter value for fare: 16 old 1: insert into ticketdetail values('&tno','&name','&sex','&age','&fare')

new 1: insert into ticketdetail values('03','anand','m','28','16') 1 row created.

SQL> / Enter value for tno: 04 Enter value for name: goutham Enter value for sex: m Enter value for age: 24 Enter value for fare: 17 old 1: insert into ticketdetail values('&tno','&name','&sex','&age','&fare') new 1: insert into ticketdetail values('04','goutham','m','24','17') 1 row created.

SQL> / Enter value for tno: 05 Enter value for name: sandeep Enter value for sex: m Enter value for age: 30 Enter value for fare: 18 old 1: insert into ticketdetail values('&tno','&name','&sex','&age','&fare') new 1: insert into ticketdetail values('05','sandeep','m','30','18') 1 row created. SQL> select *from ticketdetail; TNO NAME S AGE FARE --------- -------------------- - --------- --------1 charu f 24 14 2 latha f 10 15 3 anand m 28 16 4 goutham m 24 17 5 sandeep m 30 18 SQL> create table ticketheader(fid number(5),tno number(5),doj date,dot date,timetravel char(8),boardplace varchar2(20),orgin varchar2(20),destination varchar2(20),adults number(3),children number(3),totfare number(7,2),rid number(5)); Table created.

SQL> insert into ticketheader values('&fid','&tno','&doj','&dot','&timetravel','&boardplace','&orgin ','&destination','&adults','&children','&totfare','&rid'); Enter value for fid: 01 Enter value for tno: 01 Enter value for doj: 1-april-96 Enter value for dot: 10-may-96 Enter value for timetravel: 15-00-00 Enter value for boardplace: parrys Enter value for orgin: chennai Enter value for destination: madurai Enter value for adults: 1 Enter value for children: 1 Enter value for totfare: 60 Enter value for rid: 101 old 1: insert into ticketheader values('&fid','&tno','&doj','&dot','&timetravel','&boardplace','&o new 1: insert into ticketheader values('01','01','1-april-96','10-may-96','15-00-00','parrys','che 1 row created.

SQL> / Enter value for fid: 02 Enter value for tno: 02 Enter value for doj: 12-april-96 Enter value for dot: 05-may-96 Enter value for timetravel: 09:00:00 Enter value for boardplace: kknager Enter value for orgin: madurai Enter value for destination: chennai Enter value for adults: 2 Enter value for children: 1 Enter value for totfare: 60 Enter value for rid: 101

old 1: insert into ticketheader values('&fid','&tno','&doj','&dot','&timetravel','&boardplace','&o new 1: insert into ticketheader values('02','02','12-april-96','05-may96','09:00:00','kknager','m 1 row created. SQL> / Enter value for fid: 03 Enter value for tno: 03 Enter value for doj: 21-april-96 Enter value for dot: 15-may-96 Enter value for timetravel: 21:00:00 Enter value for boardplace: adyar Enter value for orgin: chennai Enter value for destination: bangalore Enter value for adults: 4 Enter value for children: 2 Enter value for totfare: 400 Enter value for rid: 101 old 1: insert into ticketheader values('&fid','&tno','&doj','&dot','&timetravel','&boardplace','&o new 1: insert into ticketheader values('03','03','21-april-96','15-may96','21:00:00','adyar','che 1 row created.

SQL> / Enter value for fid: 04 Enter value for tno: 04 Enter value for doj: 25-april-96 Enter value for dot: 25-may-96 Enter value for timetravel: 10:00:00 Enter value for boardplace: charminar Enter value for orgin: hyderbad Enter value for destination: chennai Enter value for adults: 10

Enter value for children: 0 Enter value for totfare: 500 Enter value for rid: 103 old 1: insert into ticketheader values('&fid','&tno','&doj','&dot','&timetravel','&boardplace','&o new 1: insert into ticketheader values('04','04','25-april-96','25-may96','10:00:00','charminar', 1 row created. SQL> / Enter value for fid: 05 Enter value for tno: 250 Enter value for doj: 30-april-96 Enter value for dot: 22-may-96 Enter value for timetravel: 15:00:00 Enter value for boardplace: parrys Enter value for orgin: chennai Enter value for destination: cochin Enter value for adults: 2 Enter value for children: 2 Enter value for totfare: 141 Enter value for rid: 103 old 1: insert into ticketheader values('&fid','&tno','&doj','&dot','&timetravel','&boardplace','&o new 1: insert into ticketheader values('05','250','30-april-96','22-may-96','15:00:00','parrys','c 1 row created.

SQL> select *from ticketheader; FID TNO DOJ DOT TIMETRAV BOARDPLACE ORGIN --------- --------- --------- --------- -------- -------------------- -------------------DESTINATION ADULTS CHILDREN TOTFARE RID -------------------- --------- --------- --------- --------1 1 01-APR-96 10-MAY-96 15-00-00 parrys chennai madurai 1 1 60 101 2 2 12-APR-96 05-MAY-96 09:00:00 kknager madurai

chennai

60

101 chennai

3 3 21-APR-96 15-MAY-96 21:00:00 adyar bangalore 4 2 400 101 4 chennai 5 cochin 4 25-APR-96 25-MAY-96 10:00:00 charminar 10 0 500 103 250 30-APR-96 22-MAY-96 15:00:00 parrys 2 2 141 103

hyderbad

chennai

SQL> (select distinct(tno)from ticketheader)union(select distinct(tno)from ticketdetail); TNO --------1 2 3 4 5 250 6 rows selected.

SQL> (select distinct(tno)from ticketheader)union all(select distinct(tno)from ticketdetail); TNO --------1 2 3 4 250 1 2 3 4 5 10 rows selected. SQL> (select distinct(tno)from ticketdetail)intersect(select distinct(tno)from ticketdetail); TNO --------1 2 3

4 5 SQL> (select distinct(tno)from ticketheader)minus(select distinct(tno)from ticketdetail); TNO --------250 SQL> select *from ticketheader x where x.rid<x.tno; FID TNO DOJ DOT TIMETRAV BOARDPLACE ORGIN --------- --------- --------- --------- -------- -------------------- -------------------DESTINATION ADULTS CHILDREN TOTFARE RID -------------------- --------- --------- --------- --------5 250 30-APR-96 22-MAY-96 15:00:00 parrys chennai cochin 2 2 141 103

SQL> select *from ticketheader, ticketdetail where ticketheader.tno=ticketdetail.tno; FID TNO DOJ DOT TIMETRAV BOARDPLACE ORGIN --------- --------- --------- --------- -------- -------------------- -------------------DESTINATION ADULTS CHILDREN TOTFARE RID TNO NAME S -------------------- --------- --------- --------- --------- --------- -------------------- AGE FARE --------- --------1 1 01-APR-96 10-MAY-96 15-00-00 parrys chennai madurai 1 1 60 101 1 charu f 24 14 2 chennai 10 2 12-APR-96 05-MAY-96 09:00:00 kknager 2 1 60 101 2 latha 15 madurai f

3 3 21-APR-96 15-MAY-96 21:00:00 adyar bangalore 4 2 400 101 3 anand 28 16 4 chennai 24 4 25-APR-96 25-MAY-96 10:00:00 charminar 10 0 500 103 4 goutham 17

chennai m

hyderbad m

SQL> (select distinct(tno)from ticketheader)union(select distinct(tno)from ticketdetail); TNO --------1 2

3 4 5 250 6 rows selected.

SQL> (select(tno)from ticketheader)union all(select(tno)from ticketdetail); TNO --------1 2 3 4 250 1 2 3 4 5 10 rows selected. SQL> (select(tno)from ticketheader)intersect(select(tno)from ticketdetail); TNO --------1 2 3 4

NESTED QUERIES:

SQL> select *from ticketdetail where tno>any(select tno from ticketheader where fid='01'); TNO NAME S AGE FARE --------- -------------------- - --------- --------2 latha f 10 15 3 anand m 28 16 4 goutham m 24 17 5 sandeep m 30 18

SQL> select *from ticketheader where tno>all(select tno from ticketdetail where name='charu');

FID TNO DOJ DOT TIMETRAV BOARDPLACE ORGIN --------- --------- --------- --------- -------- -------------------- -------------------DESTINATION ADULTS CHILDREN TOTFARE RID -------------------- --------- --------- --------- --------2 2 12-APR-96 05-MAY-96 09:00:00 kknager madurai chennai 2 1 60 101 3 3 21-APR-96 15-MAY-96 21:00:00 adyar bangalore 4 2 400 101 4 chennai 5 cochin 4 25-APR-96 25-MAY-96 10:00:00 charminar 10 0 500 103 250 30-APR-96 22-MAY-96 15:00:00 parrys 2 2 141 103 chennai

hyderbad

chennai

RESULT: Thus the nested and join queries was written and executed successfully.

EX: NO: 5 DATE: AIM To execute and verify the SQL commands for Views. PROCEDURE STEP 1: Start STEP 2: Create the table with its essential attributes. STEP 3: Insert attribute values into the table. STEP 4: Create the view from the above created table. STEP 5: Execute different Commands and extract information from the View. STEP 6: Stop SQL COMMANDS 1. COMMAND NAME: CREATE VIEW COMMAND DESCRIPTION: CREATE VIEW command is used to define a view. 2. COMMAND NAME: INSERT IN VIEW COMMAND DESCRIPTION: INSERT command is used to insert a new row into the view. 3. COMMAND NAME: DELETE IN VIEW COMMAND DESCRIPTION: DELETE command is used to delete a row from the view. 4. COMMAND NAME: UPDATE OF VIEW COMMAND DESCRIPTION: UPDATE command is used to change a value in a tuple without changing all values in the tuple. 5. COMMAND NAME: DROP OF VIEW COMMAND DESCRIPTION: DROP command is used to drop the view table.

VIEWS

EXERCISE: 1. Create the table std and insert al the values within the table. 2. Describe the table std. 3. Create the view table. 4. Insert records in to the view table. 5. Display the records of the view table. 6. Delete records of the view table. 7. Display the records of view table. 8. Update records of view table. 9. Remove view table. 10. Check whether view table exist or not. OUTPUT: SQL> create table std(rno number(3)primary key,name varchar(10)not null,dept varchar( Table created. SQL> desc std; Name Null? Type ------------------------------- -------- ---RNO NOT NULL NUMBER(3) NAME NOT NULL VARCHAR2(10) DEPT VARCHAR2(5) SQL> create view stdview as select rno,name from std; View created. SQL> desc stdview; Name Null? Type ------------------------------- -------- ---RNO NUMBER(3) NAME NOT NULL VARCHAR2(10) SQL> insert into stdview values('&rno','&name'); Enter value for rno: 2 Enter value for name: magi old 1: insert into stdview values('&rno','&name') new 1: insert into stdview values('2','magi') 1 row created

SQL> / Enter value for rno: 10 Enter value for name: ashok old 1: insert into stdview values('&rno','&name') new 1: insert into stdview values('10','ashok')

1 row created.

SQL> / Enter value for rno: 34 Enter value for name: kumar old 1: insert into stdview values('&rno','&name') new 1: insert into stdview values('34','kumar')

1 row created. SQL> select *from stdview; RNO NAME --------- ---------2 magi 10 ashok 34 kumar SQL> delete from stdview where rno=34; 1 row deleted. SQL> select *from stdview; RNO NAME --------- ---------2 magi 10 ashok SQL> update stdview set name='saranya'where rno=10; 1 row updated.

SQL> select *from stdview; RNO NAME --------- ---------2 magi 10 saranya

SQL> desc stud view; table or view does not exist

RESULT: Thus the view in SQL was written executed and the putput was verified successfully.

EX NO: 6(a) DATE: CONTROL STRUCTURES

AIM: To write and execute PL/SQL program using control structures.

CONTROL STRUCTURE: PL/SQL processes the data using flow of control statements. The categories are Conditional structure Iterative control Sequential structure CONDITIONAL CONTROL: Sequence of statenebt can be executed based on some condition using the if statement. There are three forms of it statement, namely if then, if then else, and if then elseif. SYNTAX: If condition then Sequence of statements; End if; The sequence of statements is executed only if the condition evaluates to true. If it is false or null, then the control passes to the statement after end if.

ITERATIVE CONTROL: A sequence of statements can be executed any number of times using loop constructs. Loops can be broadly classified as: simple loop, for loop, while loop SYNTAX: Loop sequence of statements; end loop; SYNTAX: (while loop) While<condition> Loop Sequence of statements; End loop;

SYNTAX: (for loop) For counter in[reverse] lowerbound.upperbound Loop Sequence of statements; End loop; EXERCISE: 1. Write a simple PL/SQL program to add two numbers. 2. Write a PL/SQL program to find the greatest of three numbers using if Else. 3. Write a PL/SQL program to find the sum of odd numbers using for loop. 4. Write a PL/SQL program to find the sum of odd numbers using while loop.

PROGRAMS: Addition Of Two Numbers SQL> declare a number; b number; c number; begin a:=&a; b:=&b; c:=a+b; dbms_output.put_line('sum of'||a||'and'||b||'is'||c); end; / INPUT: Enter value for a: 23 old 6: a:=&a; new 6: a:=23; Enter value for b: 12 old 7: b:=&b; new 7: b:=12;

OUTPUT: sum of23and12is35 PL/SQL procedure successfully completed. Greatest Of Three Numbers Using If Else SQL> declare a number; b number; c number; d number; begin a:=&a; b:=&b; c:=&b; if(a>b)and(a>c) then dbms_output.put_line('A is maximum'); elsif(b>a)and(b>c)then dbms_output.put_line('B is maximum'); else dbms_output.put_line('C is maximum'); end if; end; / INPUT: Enter value for a: 21 old 7: a:=&a; new 7: a:=21; Enter value for b: 12 old 8: b:=&b; new 8: b:=12; Enter value for b: 45 old 9: c:=&b;

new 9: c:=45; OUTPUT: C is maximum PL/SQL procedure successfully completed. Summation Of Odd Numbers Using For Loop SQL> declare n number; sum1 number default 0; endvalue number; begin endvalue:=&endvalue; n:=1; for n in 1..endvalue loop if mod(n,2)=1 then sum1:=sum1+n; end if; end loop; dbms_output.put_line('sum ='||sum1); end; / INPUT: Enter value for endvalue: 4 old 6: endvalue:=&endvalue; new 6: endvalue:=4; OUTPUT: sum =4 PL/SQL procedure successfully completed.

Summation Of Odd Numbers Using While Loop SQL> declare n number; sum1 number default 0; endvalue number; begin endvalue:=&endvalue; n:=1; while(n<endvalue) loop sum1:=sum1+n; n:=n+2; end loop; dbms_output.put_line('sum of odd no. bt 1 and' ||endvalue||'is'||sum1); end; / INPUT: Enter value for endvalue: 4 old 6: endvalue:=&endvalue; new 6: endvalue:=4; OUTPUT: sum of odd no. bt 1 and4is4 PL/SQL procedure successfully completed

RESULT: Thus the PL/SQL program using control structures was written, executed and output was verified.

EX NO: 6(b) DATE:

PROCEDURES

AIM: To write and execute PL/SQL program using procedure.

PROCEDURE: A procedure is a subprogram that contains set of SQL and PL/SQL statements. A stored procedure or in a simple a proc is a named PL/SQL block which performs one or more specific task. This is similar to a procedure in the programming languages. A procedure has a header and a body. The header consists of the names of the procedure and the parameters or variables passed to the procedure. The body consists or declaration section, execution section and exception section similar to a general PL/SQL. A procedure is similar to an anonymous PL/SQL block but it is names for repeated usage.

PARAMETERS: 1. IN- the IN parameter is used to pass values to a subprogram when it is invoked. 2. OUT- THE Out parameter is used to return values to the caller of a subprogram 3. IN OUT-The IN OUT parameter is used to pass initial values to the subprogram when invoked and also it return updated values to the caller. SYNTAX: Create or replace procedure<procedure_name>[(parameter_name[IN/OUT/IN OUT] type[,..])]{IS/AS} <declaration section> BEGIN PROCEDURE_BODY EXCEPTION Exception section END Procedure_name Where 1. OR REPLACE specifies the procedure is to replace an existing procedure present. 2. You can use this option when you want to modify a procedure. 3. A procedure may be passed multiple parameters.

4. IN/OUT/IN OUT specifies the mode of the parameters. 5. Type specifies the type of the parameters. 6. Procedure body contains the SQL and PL/SQL statements to perform the procedures task. EXAMPLE: SQL>set serveroutput on SQL>CREATE or REPLACE PROCEDURE first_proc IS Greatings VARCHAR2(20); BEGIN Greatings:=Hello World; Dbms_output.put_line(greatings): end first_proc; / SQL>EXECUTE first_proc Hello world PL/SQL procedure successfully completed. When the procedure exists in the database you can easily call the routine and get the same result as before as shown here. SQL> SQL>BEGIN First_proc; END; / HELLO WORLD PL/SQL procedure successfully completed.

PROGRAMS: To find Palindrome strings SQL> create or replace procedure palindrome(str in varchar2) is 2 len number:=0; 3 cnt number :=0; 4 j number :=0; 5 begin 6 len := length(str); 7 for i in 1..len loop 8 j := i-1; 9 if substr(str,i,1) = substr(str,len-j,1) then 10 cnt := cnt+1; 11 end if; 12 end loop; 13 if cnt = len then 14 dbms_output.put_line('palindrome'); 15 else 16 dbms_output.put_line('not palindrome'); 17 end if; 18 end;

SQL> exec palindrome('malayalam'); palindrome

Sum of odd numbers using Declare Statement declare i number:=1; n number(3); f number:=0; begin n:=&n;

while i<=n loop f:=f+i; i:=i+2; end loop; dbms_output.put_line('sum of odd numbers:'||f); end; SQL> / Enter value for n: 5 old 6: new 6: n:=&n; n:=5;

sum of odd numbers:9 PL/SQL procedure successfully completed. Sum of even numbers using Declare Statement 1 2 3 4 5 6 7 8 9 10 11 declare i number:=0; n number(3); f number:=0; begin n:=&n; while i<=n loop f:=f+i; i:=i+2; end loop; dbms_output.put_line('sum of even numbers:'||f);

12 end; SQL> / Enter value for n: 5 old 6: new 6: n:=&n; n:=5;

sum of even numbers:6 PL/SQL procedure successfully completed.

RESULT: Thus the PL/SQL program using procedure was executed and the output was verified successfully.

EX NO: 6(c) DATE: AIM: To write and execute PL/SQL program using functions. FUNCTIONS: A function is a subprogram the computes and return a single value functions and procedures are structured alike, except that functions have a RETURN clause. A function has two parts: the specification and the body. The function specification begins with the keyword FUNCTION and ends the RETURN clause, which specifies the datatype of the result value. Parameter declarations are optional. Functions that take no parameters are written without parentheses. The function body begins with keyword IS and ends with keyword END followed by an optional function name. SYNTAX: CREATE or REPLACE FUNCTION function_name[(parameter_name[IN/OUT/IN OUT] type[,..])] RETURN type{IS/AS} BEGIN Function_body END Function_name; Where; 1. OR REPLACE specifies the function that is to replace an existing if present. 2. Type specifies the PL/SQL type of the parameter. 3. The body of a function must return a value of the PL/SQL type specified in the RETURN. FUNCTIONS

PROGRAMS: Factorial of N numbers SQL> create or replace function fac(n integer) 2 return integer is 3 f number; 4 begin 5 f:=1; 6 for i in 1..n 7 loop 8 f:=f*i; 9 end loop; 10 return f; 11 end; 12 / Function created. SQL> select fac(4) from dual; FAC(4) ---------24 Largest Of Three Numbers create or replace function large1(a in number,b in number,c in number) return number is begin if a>b and a>c then return a; else if b>c then return b; else return c; end if; end if;

end; SQL> / Function created. SQL> select large1 (10, 20, 30) from dual; LARGE1 (10, 20, 30) ---------------30 Palindrome: SQL> create or replace function palin(b number)return number is 2 g number(2):=1; 3 h number(2):=1; 4 f1 number(2):=1; 5 l number(2); 6 begin 7 l:=length(b); 8 h:=1; 9 for i in 1..l 10 loop 11 if substr(b,g,l)=subste(b,h,l)then 12 f1:=0; 13 else 14 f1:=1; 15 exit; 16 endif 17 g:=g+1; 18 h:=h-1; 19 end loop; 20 return(f1); 21 end palin; 22 / Function created.

SQL> declare 2 b varchar2(20):='&b'; 3 l number(2); 4 begin 5 l:=palin(b); 6 if(l=0)then 7 dbms_output.put_line('given string is palindrome'); 8 else 9 dbms_output.put_line('given sting is not palindrome'); 10 endif 11 end; 12 / Enter value for b: kalak old 2: b varchar2(20):='&b'; new 2: b varchar2(20):='kalak'; Given String Is Palindrome PL/SQL procedure is successfully completed

RESULT: Thus the PL/SQL program functions was executed and output was verified successfully.

FRONT END TOOLS


AIM: To learn the basic concepts of front end tools especially visual basic and to develop small applications using visual basic.

FRONT END TOOLS: Front end and back end are generalized terms that refers to the initial and the end of the processor. The front end responsible for collecting input in various forms the user and processing it to conform to a specification the back end can use. The front end is a kind of interface between the user and the back end. In network computing front end can refer to any hardware that optimizes or protects network traffic. It is called application front end hardware because it is placed to the network outfacing front end or boundary. Network traffic passes through the application front end hardware before entering the network. In compilers the front end translates a computer programming source language into an intermediate representation and the back end works with the internal representation to produce code in a computer output language. The back end usually optimizes to produce code that runs faster.

VISUAL BASIC: VISUAL BASIC is a high level programming language which was evolved from the earlier DOS version called BASIC. BASIC means Beginners All-purpose symbolic instruction cod. It is a very easy programming language to learn. The codes look a lot like English Language. Different software companies produced different version of BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC, JAVA BASICA and so on. However, it seems people only use Microsoft Visual Basic delay, as it is a well developed programming language and supporting resources are available everywhere. Now, there are many versions of VB exist in the market, the most popular one and still widely used by many VB programmers is none other than Visual Basic 6. we also have VB net, VB2005 and the latest VB2008, which is a fully object oriented programming (OOP) language. VISUAL BASIC is a VISUAL and events driven programming language. These are the main divergence from the old BASIC. In BASIC, programming is done in a text only environment and the program is executed sequentially. In VB, programming is done in a

graphical environment. In the old BASIC, you have to write program codes for each graphical object you wish to display it on screen, including its position and its color. However, in VB, you just need to drag and drop any graphical object anywhere on the form, and you can change its color any time using the properties windows. On the other hand, because users may click on certain object randomly, so each object has to be programmed independently to be able to response to those actions (events). Therefore, a VB programmer is made up of many subprograms, each has its own program codes, and each can be executed independently and at the same time each can be linked together in one way or another. What program can you create with Visual Basic 6? With VB6, you can create any program depending on your objective. For example, if you are a college or university lecture, you can create educational programs to teach business, economics, engineering, computer science, accountancy, financial management, information system and more to make teaching more effective and interesting. If you are in business, you can also create business programs such as inventory management system, point-of-sale system, payroll system, financial program as well as accounting program to help manage your business and increase productivity. For those of you who like games and working as games programmer, you can create those programs as well. Indeed, there is no limit to what program you can create! There are many such programs in this tutorial, so you must spend more once on the tutorial in order to learn how to create those programs.

STRUCTURE OF A VISUAL BASIC APPLICATION Application(project) is made up of:

Forms: windows that you create(or user interface) Controls: Graphical features drawn on forms to allow user interaction(text boxes, labels, scroll bars, command buttons etc.) Properties: Every characteristic of a form or control is specified by a property. Example properties include names, captions, size, color, position and contents. Visual basic applies default properties. You can change properties at design time or runtime. Methods- built-in procedure that can be invoked to impart some action to a particular object. Event procedures: Code related to some object. This is the that is executed whan a certain event occurs.

General procedures: Code not related to objects. This code must be invoked by the application. Modules: collection of general procedures variable declarations and constant definitions used by application. On start up, Visual Basic will display the following windows: The Blank From window The Project window The Properties window It includes a Toolbox that consists of all the controls essential for developing a VB application. Controls are tools such as boxes, buttons, labels and other objects draw on a form to get input or display output. They also add visual appeal

EX NO: 7 DATE:

FROMS

AIM: To create a form for arithmetic calculator using Microsoft Visual Basic 6.0

PROCEDURE: STEP 1: Start STEP 2: Create the form with essential controls in tool box. STEP 3: Write the code for doing the appropriate functions. STEP 4: Save the forms and project. STEP 5: Execute the form. STEP 6: Stop PROGRAM: Form1 Private Sub Command1_Click() Dim a As Integer a = Val(Text1.Text) + Val(Text2.Text) MsgBox ("Addition of Two numbers is" + Str(a)) End Sub Private Sub Command2_Click() Dim b As Integer b = Val(Text1.Text) - Val(Text2.Text) MsgBox ("Subraction of Two numbers is" + Str(b)) End Sub Private Sub Command3_Click() Dim c As Integer c = Val(Text1.Text) * Val(Text2.Text)

MsgBox ("Multiplication of Two numbers is" + Str(c)) End Sub Private Sub Command4_Click() Dim d As Integer d = Val(Text1.Text) / Val(Text2.Text) MsgBox ("Division of Two numbers is" + Str(d)) End Sub Private Sub Command5_Click() End End Sub

Sample Snapshot:

RESULT: Thus the program has been loaded and executed successfully.

EX: NO: 8 DATE:


AIM To develop and execute a Trigger for before and after update, delete, insert operations on a table. PROCEDURE STEP 1: Start STEP 2: Initialize the trigger with specific table id. STEP 3: Specify the operations (update, delete, insert) for which the trigger has to be Executed. STEP 4: Execute the Trigger procedure for both before and after sequences STEP 5: Carryout the operation on the table to check for Trigger execution. STEP 6: Stop EXECUTION 1. Create table with fields itemcode, orderno, quantity, qty delivered. SQL> create table or1(itco char(5),orno char(5),qtydel number(5)); Table created. SQL> select * from or1; ITCO ORNO ----- ----- --------p5 p2 p1 p3 05 02 01 03 35 23 50 34 QTYDEL

TRIGGERS

2. Create a trigger for insert. SQL> create or replace trigger tri1 before insert on or1 for each row 2 begin 3 dbms_output.put_line('A row is going to be inserted');

4 end; 5 / Trigger created. SQL> insert into or1 values('p4','04','22'); 1 row created. SQL> select * from or1; ITCO ORNO ----- ----- --------p5 p2 p1 p3 p4 05 02 01 03 04 35 23 50 34 22 QTYDEL

SQL> create or replace trigger tri4 before update on or1 for each row 2 begin 3 if:old.orno='02' then 4 raise_application_error(-20001,'cant update'); 5 end if; 6 end; 7 / SQL> update or1 set qtydel='50' where orno='01'; 1 row updated. SQL> select * from or1; ITCO ORNO ----- ----- --------p5 p2 p1 p3 p4 05 02 01 03 04 35 23 50 34 22 QTYDEL

SQL> create or replace trigger tri4 before delete on or1 for each row 2 begin 3 if:old.orno='01' then 4 raise_application_error(-20001,'cant delete'); 5 end if; 6 end; 7 / Trigger created. SQL> delete from or1 where orno='05'; 1 row deleted. SQL> select * from or1; ITCO ORNO ----- ----- --------p2 p1 p3 p4 02 01 03 04 23 50 34 22 QTYDEL

RESULT Thus the Trigger procedure has been executed successfully.

EX: NO: 9 DATE: AIM To design a menu using Visual Basic. PROCEDURE STEP 1: Start STEP 2: Create the form with essential controls and insert the menu using menu editor. STEP 3: Write the code for doing the appropriate functions. STEP 4: Save the forms and project. STEP 5: Execute the form. STEP 6: Stop MENU DESIGN: To create a menu named file with its level two items as New, open, save, save as, print and exit and a menu named Help with its level two items as about. The procedure is as follows. 1. Start a new VB project and invoke the menu Editor using icon in the tool bar or select menu editor from tools menu. The menu editor screen appears as shown below. MENU DESIGN

2. For caption type &file(by placing the ampersand to the left of the F we establish F as an access key for the File item it enables the user to drop down the File menu by keying Alt+F on the keyboard in addition to clicking the File item with the mouse. For name, type mnuFile. Your menu editor screen should look like yhis:

Click the Next button 3. Click the right arrow button(shown circled below). A ellipsis(.) will appear as the next item in the menu list, indicating that this item is a level-two item(below File) For caption, type &new; for Name, type mnuFile and for shortcut, select Ctrl+N. 4. For caption, type (a hypen), and for Name, type mnuFileBar1. A single hypen as the caption for a menu item tells VB to create a separator bar at that location. Your menu editor screen should look like this.

5. Repeat the same procedure for all menu items

6. Back in the VB IDE your form will now have a menu, based on what you have set up in the menu editor. If you click on a top-level menu item, the level two menu will drop down.

7. Click on the new menu item. the code window for the mnuFilenew_click event opens,as shown below.

8. In the place mnuFileNew_click event, place the code you want to execute when the user clicks the new menu item. Since this is a just a demo, we will place a simple MsgBox statement in the event procedure.

9. Run the program. Note how the code executes when you click on the various menu items. Also test the use of the access keys and shortcut keys.

EXECUTION Form 1 Private Sub mapple_Click() MsgBox ("You selected Apple") End Sub Private Sub mblue_Click() MsgBox ("You selected Blue color") End Sub Private Sub mcircle_Click() MsgBox ("You selected Circle") End Sub Private Sub mexit_Click() End End Sub Private Sub mgrapes_Click() MsgBox ("You selected Grapes") End Sub Private Sub mgreen_Click() MsgBox ("You selected Green color ") End Sub Private Sub morange_Click() MsgBox ("You selected Orange") End Sub Private Sub mrectangle_Click() MsgBox ("You selected Rectangle") End Sub Private Sub mred_Click() MsgBox ("You selected Red color") End Sub Private Sub mtriangle_Click() MsgBox ("You selected Triangle") End Sub

OUTPUT:

RESULT Thus the program for menu creation with menu editor has been developed and executed successfully.

EX NO: 10(a) DATE: AIM: To display a payroll system and display the employee details using visual basic and orclae. PROCEDURE: 1. Start 2. Design a form with commands buttons, employee details and exit. 3. Design another form with employee name,date of birth, date of joining, address, basic pay, qualification and experience. 4. Create the database in oracle. 5. Create the table in database. 6. Add the fields emp_no, emp_name, DOB,DOJ, address, basic pay, qualification and experience. 7. Set database name and record source property of DAO in property dialog box of DAO. 8. Set data source property and data field property of text boxes. 9. Run the program. 10. End. DATABASE DESIGN AND IMPLEMENTATION

PROGRAM: Private Sub Command1_Click() From2.Show End Sub Private Sub Command2_Click() End End Sub

Private Sub Command1_Click() Adodc1.Recordset.AddNew End Sub Private Sub Command2_Click() Adodc1.Recordset.Update End Sub Private Sub Command3_Click() Adodc1.Recordset.Delete End Sub Private Sub Command4_Click() Form1.Show End Sub

OUTPUT: FORM-1

FORM-II

OUTPUT FORM:

RESULT: Thus the payroll system to display the employee details was designed using Visual Basic and oracle and the output was verified successfully.

EX NO: 10(b) DATE: LIBRARY MANAGEMENT SYSTEM

AIM: To design a library management system using Visual basic and oracle.

PROCEDURE: 1. Start 2. Design a form with library management system, book details, label box and command buttons respectively. 3. Design another forms with details such as book id, author, label box and text boxes. 4. Create the database using oracle. 5. Create database using database. 6. Insert the values in tables. 7. Set the database name and record source property of text boxes. 8. Set the data source and data field property of text boxes. 9. Run the program. 10. Stop.

PROGRAM:

Private Sub Command1_Click() Form2.Show End Sub Private Sub Command2_Click() End End Sub

Private Sub Command1_Click() Form1.Show End Sub Private Sub Command2_Click() Adodc1.Recordset.AddNew End Sub Private Sub Command3_Click() Adodc1.Recordset.Delete End Sub Private Sub Command4_Click() Adodc1.Recordset.Update End Sub

OUTPUT: FORM-1

FORM-2:

OUTPUT: FORM:

RESULT: Thus the library management was designed using visual basic and output was verified successfully.

EX NO: 11 DATE: REPORT GENERATION USING FUNCTIONS AIM: To write and execute PL/SQL program using reports PROCEDURE: 1. Start 2. Open the oracle from start menu. 3. Type the program that is provided. 4. Take the output to the program that is necessary. 5. Stop the execution. 6. End. FUNCTION: A function is a subprogram that computes a value. SYNTAX: Create or replace function<function name>[argument]return datatype is (local declaration) Begin (executable statements) [exception] (exception handlers) End; Where arguments can be in, out and in out. Like a procedure, a function also has two parts, namely the function specification and the function body. The function specification begins with the keyword function and ends with the return clause. The function begins with the keyword is and ends with the keyword end. PROCEDURE: 1. Switch ON the system and in windows select SQL/PLUS. 2. After the log on windows open, write the user name, password and host string and press ok. 3. When a new window opens with prompt<SQL> here we type an SQL commands.

PROGRAM: SQL> create or replace function total(t number) return number is 2 ba number; 3 begin 4 if(t>300) then 5 ba:=t*3.00; 6 else 7 ba:=t*1.50; 8 end if; 9 return ba; 10 end; 11 / Function created.

SQL> declare 2 no eb2.cno%type; 3 name eb2.cname%type; 4 cm eb2.cmr%ttype; 5 pm eb2.pmr%type; 6 rp eb2.rup%type; 7 tr number; 8 ba number; 9 begin 10 select cno, cname, cmr, pmr, rup into no, name, cm, pm, rp from eb2 where cno=&no; 11 tr:=cm-pm; 12 ba:=total(tr); 13 dbms_output.put_line(CUSTOMER NO :!!no); 14 dbms_output.put_line(CUSTOMER NAME:!!name); 15 dbms_output.put_line(TOTAL READING: !!tr); 16 dbms_output.put_line(BILL AMOUNT:!! ba); 17 end; 18 /

OUTPUT:

SQL>create table eb2(cno number(3), cname varchar2(10), cmr number(3), pmr number(3), rup number(3)); Table created. SQL> insert into eb2 values(&cno,&cname,&cmr,&pmr,&rup); Enter value for cno: 110 Enter value for cname: veni Enter value for cme: 400 Enter value for pmr: 350 Enter value for rup: 50 1 row created

SQL>/ Enter value for cno: 111 Enter value fro cname: deepa Enter value for cmr: 350 Enter value fro pmr: 250 Enter value for rup: 45 1 roe created

SQL>/ Enter value for cno: 112 Enter value for cname: geetha Enter value fro cmr: 200 Enter value for pmr: 150 Enter value for rup: 30 1 row created SQL> select *from eb2;

CNO CNAME

CMR

PMR

RUP

-------- ----------- --------- ------ -------110 111 112 veni deepa geetha 400 350 200 350 250 150 50 45 30

Enter value for no: 110 Old 10:select cno, cname, cmr, pmr, rup into no, name, cm, pm, rp from eb2 where cno=&no; New 10:select cno,cname, cmr, pmr, rup into no, name, cm, pm, rp from eb2 where cno=110; CUSTOMER NO :110 CUSTOMER NAME: veni TOTAL READING :50 BILL AMOUNT :75

PL/SQL procedure successfully completed.

RESULT: Thus the PL/SQL program using was entered, executed and verified successfully.

Anda mungkin juga menyukai