Rdbms Writing and Print
Rdbms Writing and Print
Rdbms Writing and Print
DATE:
AIM:
To write the SQL queries using DDL Commands with and without constraints.
DDL STATEMENTS
1. CREATE TABLE
2. ALTER TABLE
3. DROP TABLE
SYNTAX:
1. Create Table
……..
);
2. Alter Table
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
a. To Add a column
ALTER TABLE table_name ADD column_name datatype
3. Drop Table
Used to delete the table permanently from the storage
RENAME
To alter the table name by using rename keyword
Create Table:
Alter Table :
a. ADD
b. DROP
c. MODIFY
RENAME:
DROP:
Result:
Thus the SQL queries using DDL Commands were successfully executed and verified.
EX NO:1B DATA MANIPULATION LANGUAGE
DATE:
AIM:
DML STATEMENTS
INSERT
UPDATE
DELETE
SELECT
SYNTAX:
1. Insert
2. Update
3.Delete
4.SELECT:
RETRIEVING TABLES
Any sql SELCECT statements retrieve records from table using clause.
Create table:
1. INSERT:
2. UPDATE:
3. DELETE:
4. SELECT:
RESULT:
Thus the SQL queries using DML Commands were successfully executed and verified.
EXNO:1C TRANSACTION CONTROL LANGUAGE
DATE:
AIM:
TCL COMMANDS
1. COMMIT
2. ROLLBACK
3. BEGIN
4. SAVEPOINT
SYNTAX:
1. COMMIT
COMMIT;
2. ROLLBACK
ROLLBACK[TO SAVEPOINT_NAME];
3. BEGIN
BEGIN;
4. SAVEPOINT
SAVEPOINT[savepoint_names]
PRINT:
Create table
Insert
COMMIT:
ROLLBACK:
SAVEPOINT:
Result:
Thus the SQL queries using TCL Commands were successfully executed and verified.
EXNO:2A AGGREGATE FUNCTIONS
DATE:
AIM:
Create Table
……..
);
Insert
AGGREGATE FUNCTIONS
1. Count
2. Max
3. Min
4. Sum
5. Avg
SYNTAX:
1. COUNT
2. MAX
3. MIN
4. SUM
Select SUM <column_name> FROM <table_name>;
5. AVG
AGGREGATE FUNCTIONS
Create table
Insert
COUNT:
MAX:
MIN:
SUM:
AVG:
RESULT:
Thus the SQL queries using aggregate functions were successfully executed and verified.
EX NO:2B SQL JOINS
DATE :
AIM:
Create Table
……..
);
Insert
JOIN TYPES:
1. INNER JOIN
2. OUTER JOIN
3. SELF JOIN
4. EQUI JOIN
SYNTAX
1. INNER JOIN
SELECT column_name(S)
FROM table 1
INNER JOIN table 2
ON table1.column_name=
table2.column_name;
2. OUTER JOIN
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=
table2.column_name;
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=
table2.column_name;
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=
table2.column_name;
3. SELF JOIN
SELECT column_name(s)
FROM table1,table2
WHERE condition;
4. EQUI JOIN
SELECT column_name(s)
FROM table1,table2
WHERE condition;
PRINT:
SQL JOINS
CREATE TABLE:
Table 1:
Table 2:
Insert:
Table 1:
Table 2:
INNER JOIN:
Table 1:
Table 2:
OUTER JOIN:
a. LEFT OUTER JOIN :
EQUI JOIN:
SELF JOIN:
Create Table:
Insert:
SELF JOIN:
RESULT:
Thus the SQL queries using SQL joins were successfully executed and verified.
EX NO: 2c NESTED QUERIES
DATE:
AIM:
Create Table
……..
);
Insert
NESTED SUBQUERIES
NESTED QUERIES
Create table:
Insert:
Query:
RESULT
Thus all the above SQL nested queries has been executed successfully and the output was verified.
EX NO:3 VIEW SYNONYMS SEQUENCE
DATE:
AIM:
SYNTAX
Create Table
……..
);
Insert
A. VIEW
CREATE VIEW view_name AS<QUERY EXPRESSION>
INSERT VIEW
UPDATE VIEW
DROP VIEW
DROP view_name;
B.SYNONYMS
Create Synonym:
Create synonym syn_name for table_name;
Delete Synonym:
C. SEQUENCE
INSERT SEQUENCE
Delete SEQUENCE:
Create Table:
Insert:
1. CREATE VIEW:
3. UPDATE VIEW:
DROP VIEW:
B. SYNONYMS
CREATE TABLE & INSERT:
Create Synonym:
C. SEQUENCE
Create & insert:
CREATE SEQUENCE:
INSERT SEQUENCE:
DELETE SEQUENCE:
RESULT
Thus the SQL queries using views,sequence ,synonyms were successfully executed and verified.
Ex:No:4 TRIGGERS
Date:
AIM:
TABLE 1
Create Table
……..
);
Insert
TABLE 2
Create Table2
……..
);
Insert
UPDATE TRIGGER
TRIGGERS
Create Table 1:
Insert:
Create Table 2:
TRIGGER:
UPDATE TRIGGER:
RESULLT:
Thus the SQL queries to create triggers were successfully executed and verified.
Ex. No. 5 FUNCTIONS AND PROCEDURES
Date:
AIM:
FUNCTIONS
SYNTAX :
BEGIN
END;
PROCEDURE:
SYNTAX
Create Table
……..
);
PROCEDURE CREATION
{IS|AS}
BEGIN
<procedure_body>
END procedure_name;
PRINT:
FUNCTIONS AND PROCEDURES
Functions
Create table & Insert:
FUNCTION CREATION:
FUNCTION CALL:
PROCEDURE
PROCEDURE CREATION:
RESULT:
Thus the PL/SQL queries to create functions and procedures were successfully executed and verified
EXNO:6 IMPLICIT AND EXPLICIT CURSOR
DATE:
AIM:
SYNTAX
Create Table
……..
);
Insert
DECLARE cursor_name
CURSOR
FOR SELECT* FROM table_name
BEGIN
OPEN cursor_connection
FETCH
NEXT/FIRST/LAST/PRIOR/ABSOLUTE
n/RELATIVE n FROM cursor_name
CLOSE cursor_name
END
PRINT:
Thus the SQL queries to create implicit and explicit cursor were successfully executed and verified.
Ex no:7 EXCEPTIONAL HANDLING
Date:
AIM:
DECLARE
<declaration section>
BEGIN
<executable command (s)>
EXCEPTION
<exception handling goes here>
WHEN exception 1 THEN
Exception1-handling-statements
WHEN exception 2 THEN
Exception2-handling-statements
WHEN exception 3 THEN
Exception3-handling-statements
…………
WHEN others THEN
Exception3-handling-statements
END;
PRINT:
EXCEPTIONAL HANDLING
Exceptional handling:
RESULT:
Thus the SQL statement that handles exceptions were successfully executed and verified.
EX NO:8 ER MODELLING
DATE:
AIM:
To design a database Design using ER modelling and normalization to set various constraints.
PROCEDURE:
The Attributes in the .Entities:
Bus: (ENTITY)
Bus
RESERVATION: (ENTITY)
TICKET: (ENTITY)
CANCELLATION: (ENTITY)
PRINT:
Create table:
ALGORITHM :
TABLE STRUCTURE :
EMPID NUMBER(4)
ENAME VARCHAR2(17)
BASICPAY NUMBER(7)
HRA NUMBER(7)
DA NUMBER(7)
GRSPAY NUMBER(7)
ESI NUMBER(7)
PF NUMBER(7)
DEDUCTION NUMBER(7) NETPAY
NUMBER(7)
PRINT:
SQL>create table emp(eno number primary key,enamr varchar(20),age number,addr varchar(20),DOB date,phno
number(10)); Table created.
SQL>create table salary(eno number,edesig varchar(10),basic number,da number,hra number,pf number,mc
number,met number,foreign key(eno) references emp);
Table created.
TRIGGER to calculate DA,HRA,PF,MC
SQL> create or replace trigger employ
2 after insert on salary
3 declare
4 cursor cur is select eno,basic from salary;
5 begin
6 for cur1 in cur loop
7 update salary set
8 hra=basic*0.1,da=basic*0.07,pf=basic*0.05,mc=basic*0.03 where hra=0;
9 end loop;
10 end;
11 / Trigger created
Thus a database in Oracle is connected with front end tool Visual Basic.
EXNO: 10a CASE STUDY USING REAL LIFE DATABASE APPLICATION
DATE: LIBRARY INFORMATION PROCESSING
AIM:
TO execute a case study using real life database application for processing library information using visual basic forms
connected with sql.
ALGORITHM:
TABLE STRUCTURE :
ID NUMBER(3)
NAME VARCHAR2(15)
DEPT VARCHAR2(10)
YEAR NUMBER(4)
BNO NUMBER(5)
BNAME VARCHAR2(20)
AUTHOR VARCHAR2(15)
COPIES NUMBER(2)
ISSUE DATE
PRINT:
CASE STUDY USING REAL LIFE DATABASE APPLICATION
LIBRARY INFORMATION PROCESSING
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cd As ADODB.Command
Private Sub Add_click()
Dim sql As String
Set cd = New ADODB.Command
sql ="insert into lib values(" & Val(Text1.Text) & ",'" & (Text2.Text) & "','" & (Text3.Text) & "'," &
Val(Text4.Tex) & "," & Val(Text5.Text) & ",'" & (Text6.Text) & "','" & (Text7.Text) & "'," &
Val(Text8.Text) & ",'" & (Text9.Text) & "','" & (Text10.Text) & "','" & (Text11.Text) & "'," &
Val(Text12.Text) & "," & Val(Text13.Text) & ")"
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
Set rs = New ADODB.Recordset
rs.Open "Select * from LIB", cn, adOpenKeyset, adLockOptimistic
MsgBox "Record Added"
End Sub
Private Sub Delete_click()
Dim cd As New ADODB.Command
Dim n As Integer
Dim sql As String
n = Val(InputBox("Enter the ID No. to delete :","input"))
Set cd = New ADODB.Command
sql ="DELETE FROM LIB WHERE ID =" & n
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
MsgBox "Successfully deleted"
Set rs = New ADODB.Recordset
rs.Open "Select * from LIB", cn, adOpenKeyset, adLockOptimistic
End Sub
Private Sub EXIT_Click()
End
End Sub
Private Sub Report_Click()
DataReport1.Show
End Sub
Private Sub search_click()
Dim n As Integer
Dim rs As ADODB.Recordset
On Error GoTo err
n = Val(InputBox("Enter the ID No. to search","input"))
Set rs = New ADODB.Recordset
rs.Open "Select *From LIB where ID=" & n, cn, adOpenKeyset, adLockOptimistic
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
Text5.Text = rs(4)
Text6.Text = rs(5)
Text7.Text = rs(6)
Text8.Text = rs(7)
Text9.Text =
rs(8)
Text10.Text = rs(9)
Text11.Text = rs(10)
Text12.Text = rs(11)
Text13.Text = rs(12)
Exit Sub
err: MsgBox "not found"
End Sub
Private Sub modify_click()
Dim sql As String
Dim n As Integer
n = Val(InputBox("Enter the ID No. to update : ","input"))
Set cd = New ADODB.Command
sql ="Update LIB set ID =" & Val(Text1.Text) & ",NAME='" & (Text2.Text) & "',DEPT='" & (Text3.Text)
& "', YEAR=" & Val(Text4.Text) & ",BNO=" & Val(Text5.Text) & ",BNAME='" & (Text6.Text) &
"',AUTHOR='" & (Text7.Text) & "',COPIES=" & Val(Text8.Text) & ",ISSUE='" & (Text9.Text) &"',RETURN='" &
(Text10.Text) & "',CUR_DATE='" & (Text11.Text) & "', NO_DAYS=" & Val(Text12.Text)& ",PENALTY=" &
Val(Text13.Text) & " where ID&n
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
MsgBox "Modified"
Set rs = New ADODB.Recordset
rs.Open "Select * from LIB", cn, adOpenKeyset, adLockOptimistic
End Sub
Private Sub first_click()
rs.MoveFirst
Call give
End Sub
Private Sub Next_click()
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
MsgBox ("Reached Last Record
") End If
Call give
End Sub
Private Sub Last_click()
rs.MoveLast
Call give
End Sub
Private Sub previous_click()
rs.MovePrevious
If rs.BOF = True Then
rs.MoveFirst
MsgBox ("Reached First Record ")
End If
Call give
End Sub
Private Sub clear_click()
Text1.Text =" "
Text2.Text =" "
Text3.Text =" "
Text4.Text =" "
Text5.Text =" "
Text6.Text =" "
Text7.Text =" "
Text8.Text =" "
Text9.Text =" "
Text10.Text =" "
Text11.Text =" "
Text12.Text =" "
Text13.Text =" "
End Sub
Private Sub Form_load()
Set cn = New ADODB.Connection
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
Set rs = New ADODB.Recordset
rs.Open " Select * from LIB", cn, adOpenKeyset, adLockOptimistic
Call give
End Sub
Private Sub give()
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
Text5.Text = rs(4)
Text6.Text = rs(5)
Text7.Text = rs(6)
Text8.Text = rs(7)
Text9.Text = rs(8)
Text10.Text = rs(9)
Text11.Text = rs(10)
Text12.Text = rs(11)
Text13.Text = rs(12)
End Sub
Private Sub text9_Gotfocus()
Text9.Text = Format(Text9.Text,"Medium date")
End Sub
Private Sub text10_Gotfocus()
Text10.Text = Format(Text10.Text,"medium date")
End Sub
Private Sub text11_Gotfocus()
a$ = Format(Now,"medium date")
Text11.Text = a$
End Sub
Private Sub text12_click()
Dim n As Integer
n = Val(Text11.Text)- Val(Text10.Text)
Text12.Text = n
If n < 0 Then
Text12.Text = 0
MsgBox ("Book is Received before the Due Date ...")
End If
End Sub
Private Sub text13_click()
If Val(Text11.Text) < Val(Text10.Text) Then
Text13.Text = 0
MsgBox ("No Penalty !!!")
Else
Text13.Text = Val(Text12.Text) * 2
End If
End Sub
Output:
Report:
RESULT:
Thus the program for library information processing has been created and generated report successfully.
Ex.no:10b CASE STUDY USING REAL LIFE DATABASE APPLICATION
Date: STUDENT MARKSHEET PROCESSING USING IMAGES
AIM:
To execute a casestudy using real life database application for student marksheet processing using visual basic
forms connected with sql.
ALGORITHM:
TABLE STRUCTURE :
RNO NUMBER(5)
NAME VARCHAR2(17)
DOB DATE
SEX VARCHAR2(7)
ENG NUMBER(3)
HINDI NUMBER(3)
MAT NUMBER(3)
SCI NUMBER(3)
SOCIAL NUMBER(3)
TOTAL NUMBER(5)
AVG NUMBER(5,2)
GRADE VARCHAR2(1)
RESULT VARCHAR2(5)
PRINT:
CASE STUDY USING REAL LIFE DATABASE APPLICATION
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cd As ADODB.Command
Private Sub ADD_Click()
Dim sql As String
Set cd = New ADODB.Command
sql = "INSERT INTO STUDENT VALUES (" & Val(Text1.Text) & ",'" & (Text2.Text) & "','" & (Text3.Text) & "','" &
(Text4.Text) & "'," & Val(Text5.Text) & "," & Val(Text6.Text) & "," & Val(Text7.Text) & "," &
Val(Text8.Text) & "," & Val(Text9.Text) & "," & Val(Text10.Text) & "," & Val(Text11.Text) & ",'" & (Text12.Text) & "','"
& (Text13.Text) & "')"
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM STUDENT", cn, adOpenKeyset, adLockOptimistic
MsgBox "Record Successfully Added !!!"
End Sub
Private Sub CLEAR_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
Text13.Text = " "
End sub
Private Sub DELETE_Click()
Dim cd As New ADODB.Command
Dim n As Integer
Dim sql As String
n = Val(InputBox("Enter the RollNo. to be deleted : ", "input"))
Set cd = New ADODB.Command
sql = "DELETE FROM STUDENT WHERE RNO=" & n
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
MsgBox ("Record Successfully Deleted !!!")
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM STUDENT", cn, adOpenKeyset, adLockOptimistic
End Sub
Private Sub END_Click()
End End Sub
Private Sub FIRST_Click()
rs.MoveFirst
Call give
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
Set rs = New ADODB.Recordsetrs.Open "SELECT * FROM STUDENT", cn, adOpenKeyset, adLockOptimistic
MsgBox "Record Successfully Added !!!"
End Sub
Private Sub LAST_Click()
rs.MoveLast
Call give
End Sub
Private Sub MODIFY_Click()
Dim sql As String
Dim n As Integer
n = Val(InputBox("Enter the RollNo. to update : ", "input"))
Set cd = New ADODB.Command
sql = "UPDATE STUDENT SET RNO = " & Val(Text1.Text) & ",NAME='" & (Text2.Text) & "',DOB='" &
(Text3.Text) & "', SEX='" & (Text4.Text) & "', ENG=" & Val(Text5.Text) & ", HINDI=" & Val(Text6.Text) & ",MAT=" &
Val(Text7.Text) & ", SCI=" & Val(Text8.Text) & ",SOCIAL=" & Val(Text9.Text) & ",TOTAL=" & Val(Text10.Text) & ", AVG
=" & Val(Text11.Text) & ", GRADE ='" & (Text12.Text) & "',RESULT='" & (Text13.Text) & "' WHERE RNO =" & n
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
MsgBox ("Record Successfully Modified !!!")
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM STUDENT", cn, adOpenKeyset, adLockOptimistic
End Sub
Private Sub NEXT_Click()
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
MsgBox ("Reached last Record !!!")
End If
Call give
End Sub
Private Sub PREVIOUS_Click()
rs.MovePrevious
If rs.BOF = True Then
rs.MoveFirst
MsgBox ("Reached First Record !!!") End If
Call give
End Sub
Private Sub REPORT_Click()
DataReport1.Show
End Sub
Private Sub SEARCH_Click()
Dim n As Integer
Dim rs As ADODB.Recordset
On Error GoTo err
n = Val(InputBox("Enter the RollNo. to search : ", "input"))
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM STUDENT WHERE RNO=" & n, cn, adOpenKeyset, adLockOptimistic
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
Text5.Text = rs(4)
Text6.Text =
rs(5)
Text7.Text = rs(6)
Text8.Text = rs(7)
Text9.Text = rs(8)
Text10.Text = rs(9)
Text11.Text = rs(10)
Text12.Text = rs(11)
Text13.Text = rs(12)
Exit Sub
err: MsgBox ("Sorry !! Record Not Found ...")
End Sub
Sub give()
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
Text5.Text = rs(4)
Text6.Text = rs(5)
Text7.Text = rs(6)
Text8.Text = rs(7)
Text9.Text = rs(8)
Text10.Text = rs(9)
Text11.Text = rs(10)
Text12.Text = rs(11)
Text13.Text = rs(12)
End Sub
Private Sub Text10_Click()
Dim m1, m2, m3, m4, m5 As Integer
m1 = Val(Text5.Text)
m2 = Val(Text6.Text)
m3 = Val(Text7.Text)
m4 = Val(Text8.Text)
m5 = Val(Text9.Text)
Text10.Text = m1 + m2 + m3 + m4 + m5
Text11.Text = Val(Text10.Text) / 5
End Sub
Private Sub Text12_click()
If (Val(Text10.Text) > 90) Then
Text12.Text = "O"
ElseIf (Val(Text10.Text) > 80) Then
Text12.Text = "A"
ElseIf (Val(Text10.Text) > 70) Then
Text12.Text = "B"
ElseIf (Val(Text10.Text) > 60) Then
Text12.Text = "C"
ElseIf (Val(Text10.Text) > 50) Then
Text12.Text = "D"
ElseIf (Val(Text10.Text) > 40) Then
Text12.Text = "E"
Else
Text12.Text = "F"
End If
End Sub
Private Sub Text13_Click()
If (Val(Text5.Text) >= 40 And Val(Text6.Text) >= 40 And Val(Text7.Text) >= 40 And
Val(Text8.Text) >= 40 And Val(Text9.Text) >= 40) Then
Text13.Text = "PASS"
Else
Text13.Text =
"FAIL" End If
End Sub
Output:
FORM:
RESULT:
Thus the program for student marksheet processing using images has been created and generated report
successfully.
Ex.no:10c CASE STUDY USING REAL LIFE DATABASE APPLICATION
Date: BANK TRANSACTIONS
AIM:
To execute a casestudy using real life database application for bank transaction using visual basic forms connected with
sql.
ALGORITHM:
withdraw.
5) ‘ Intr’
,
‘ tot_int‘ & ‘ tot_amt’ are derived attributes.
cur_bal + tot_int).
TABLE STRUCTURE :
ACCNO NUMBER(7)
CUS_NAME VARCHAR2(15)
ADDRESS VARCHAR2(15)
PH_NO VARCHAR2(11)
INIT_AMT NUMBER(10,2)
ACC_DATE DATE TRANS_DATE
DATE
DEP_WD NUMBER(10,2)
CUR_BAL NUMBER(10,2)
CUR_DATE DATE
NO_DAYS NUMBER(5)
INTR NUMBER(3)
TOT_INT NUMBER(10,2)
TOT_AMT NUMBER(10,2)
PRINT:
BANK TRANSACTIONS
Dim cn As ADODB.Connection
Dim cd As ADODB.Command
Dim rs As ADODB.Recordset
Private Sub ADD_Click()
Dim sql As String
Set cd = New ADODB.Command
sql = "INSERT INTO BANK VALUES(" & Val(Text1.Text) & ",'" & (Text2.Text) & "','" & (Text3.Text) & "','" &
(Text4.Text) & "'," & Val(Text5.Text) & ",'" & (Text6.Text) & "','" & (Text7.Text) & "'," &
Val(Text8.Text) & "," & Val(Text9.Text) & ",'" & (Text10.Text) & "'," & Val(Text11.Text) & "," &
Val(Text12.Text) & "," & Val(Text13.Text) & "," & Val(Text14.Text) & ")"
cd.ActiveConnection =cn
cd.CommandText=sql
cd.Execute
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM BANK", cn, adOpenKeyset, adLockOptimistic MsgBox
"Record Successfully Added !!!"
End Sub
Private Sub
CLEAR_Click() Text1.Text
= " " Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
Text13.Text = " "
Text14.Text = " "
End Sub
Private Sub DELETE_Click()
Dim n As Integer
Dim sql As String
Dim cd As New ADODB.Command
n = Val(InputBox("Enter the Acc no. to delete : ", "input"))
Set cd = New ADODB.Command
sql = "DELETE FROM BANK WHERE ACCNO=" & n
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
MsgBox "Record Successfully Deleted !!!"
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM BANK", cn, adOpenKeyset, adLockOptimistic
End Sub
Private Sub END_Click()
End
End Sub
Private Sub FIRST_Click()
rs.MoveFirst
Call give
MsgBox "Reached First Record !!!"
End Sub
Private Sub DELETE_Click()
Dim n As Integer
Dim sql As String
Dim cd As New ADODB.Command
n = Val(InputBox("Enter the Acc no. to delete : ", "input"))
Set cd = New ADODB.Command
sql = "DELETE FROM BANK WHERE ACCNO=" & n
cd.ActiveConnection = cn cd.CommandText = sql cd.Execute
MsgBox "Record Successfully Deleted !!!"
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM BANK", cn, adOpenKeyset, adLockOptimistic
End Sub
Private Sub END_Click()
End
End Sub
Private Sub FIRST_Click()
rs.MoveFirst Call give
MsgBox "Reached First Record !!!"
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM BANK", cn, adOpenKeyset, adLockOptimistic Call give
End Sub
Private Sub give()
Text1.Text = rs(0) Text2.Text = rs(1) Text3.Text = rs(2) Text4.Text = rs(3) Text5.Text = rs(4) Text6.Text =
rs(5) Text7.Text = rs(6) Text8.Text = rs(7) Text9.Text = rs(8) Text10.Text = rs(9) Text11.Text = rs(10)
Text12.Text = rs(11) Text13.Text = rs(12) Text14.Text = rs(13)
End Sub
Private Sub LAST_Click()
rs.MoveLast
Call give
MsgBox "Reached Last Record !!!"
End SuB
Private Sub MODIFY_Click()
Dim sql As String
Dim n As Integer
n = Val(InputBox("Enter the acc no. to update : ", "input"))
Set cd = New ADODB.Command
sql = "UPDATE BANK SET ACCNO =" & Val(Text1.Text) & ",CUS_NAME ='" & (Text2.Text) & "',ADDRESS='" &
(Text3.Text) & "',PH_NO='" & (Text4.Text) & "',INIT_AMT=" & Val(Text5.Text) & ",ACC_DATE='" &
(Text6.Text) & "',TRANS_DATE='" & (Text7.Text) & "',DEP_WD=" & Val(Text8.Text) & ", CUR_BAL =" &
Val(Text9.Text) & ",CUR_DATE='" & (Text10.Text) & "',NO_DAYS=" &
Val(Text11.Text) & ",INTR=" & Val(Text12.Text) & ",TOT_INT=" & Val(Text13.Text) & ",TOT_AMT=" &
Val(Text14.Text) & " where accno=" & n
cd.ActiveConnection = cn
cd.CommandText = sql
cd.Execute
MsgBox "Record Successfully Modified !!!"
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM BANK", cn, adOpenKeyset, adLockOptimistic
End Sub
OUTPUT:
Report:
RESULT:
Thus the program for bank transactions has been created and generated report successfully.
Ex.no:10d CASE STUDY USING REAL LIFE DATABASE APPLICATION
Date: PAYROLL PROCESSING
AIM:
To execute a casestudy using real life database application for payroll processing using visual basic forms connected with
sql.
ALGORITHM:
TABLE STRUCTURE :
EMPID NUMBER(4)
ENAME VARCHAR2(17)
BASICPAY NUMBER(7)
HRA NUMBER(7)
DA NUMBER(7)
GRSPAY NUMBER(7)
ESI NUMBER(7)
PF NUMBER(7)
DEDUCTION NUMBER(7)
NETPAY NUMBER(7)
PRINT:
Payroll processing
SQL>create table emp(eno number primary key,enamr varchar(20),age number,addr varchar(20),DOB date,phno
number(10)); Table created.
SQL>create table salary(eno number,edesig varchar(10),basic number,da number,hra number,pf number,mc
number,met number,foreign key(eno) references emp);
Table created.
TRIGGER to calculate DA,HRA,PF,MC
SQL> create or replace trigger employ
2 after insert on salary
3 declare
4 cursor cur is select eno,basic from salary;
5 begin
6 for cur1 in cur loop
7 update salary set
8 hra=basic*0.1,da=basic*0.07,pf=basic*0.05,mc=basic*0.03 where hra=0;
9 end loop;
10 end;
11 / Trigger created
AIM:
To execute a casestudy using real life database application for inventory using visual basic forms connected with sql.
ALGORITHM:
5.calculate total and current balance and perform insertion, deletion, modification in form window.
TABLE STRUCTURE:
Suppliercode varchar(9)
Suppliername varchar(9)
Itemcode varchar(9)
Itemname varchar(9)
Quantity varchar(9)
Unitprice number(9)
PRINT:
INVENTORY
Output:
Form 2:
Report:
RESULT:
Thus the program for inventory has been created and generated report successfully.
Ex.no:10f CASE STUDY USING REAL LIFE DATABASE APPLICATION
Date: PURCHASE ORDER PROCESSING
AIM:
To execute a casestudy using real life database application for purchase order processing using visual basic forms connected
with sql.
ALGORITHM:
2. Create a table in oracle for purchase order processing with required fields.
5. calculate total and current balance and perform insertion, deletion, modification in form window.
TABLE STRUCTURE:
Suppliercode varchar(9)
Suppliername varchar(9)
Itemcode varchar(9)
Itemname varchar(9)
Quantity varchar(9)
Unitprice number(9)
PRINT:
Output form1:
Form2:
Report:
RESULT:
Thus the program for purchase order processing has been created and generated report successfully.