Вы находитесь на странице: 1из 53

1 Ex.

No:1 Date: SQL: DDL, DML AND DCL COMMANDS

AIM: Use the DDL, DML and DCL, commands in SQL ALGORITHM: Step 1: Start the processes by connecting the Database Step 2: Using DDL command create tables with required fields and insert the values into the fields. Step 3: Using DML command to all the manipulation like select, update, Delete, etc., into the tables Step 4: Stop Aggregate

2 STUDY OF SQL COMMANDS SALES_REPS TABLE CREATION: SQL> create table sales_reps(rep_id number(4),name varchar(10),job varchar(10),mgr_no number(5),join_date date,sal number(7,2),commision number(7,2),dvn_no number(2)); Table created. INSERT VALUES: SQL> insert into sales_reps values(&rep_id,'&name','&job',&mgr_no,'&join_date',&sal,&commision,&dv_no); Enter value for rep_id: 1 Enter value for name: tamil Enter value for job: assistant Enter value for mgr_no: 103 Enter value for join_date: 2-jan-2000 Enter value for sal: 20000 Enter value for commision: 1000 Enter value for dv_no: 13 old 1: insert into sales_reps values(&rep_id,'&name','&job',&mgr_no,'&join_date',&sal,&commision,& new 1: insert into sales_reps values(1,'tamil','assistant',103,'2-jan-2000',20000,1000,13) 1 row created. MANAGERS TABLE CREATION: SQL> create table managers(mgr_no number(5),mgr_name varchar(15),join_date date,sal number(9,2)); Table created. SQL> commit; Commit complete. INSERT VALUES: SQL> insert into managers values(&mgr_no,'&mgr_name','&join_date',&sal); Enter value for mgr_no: 101 Enter value for mgr_name: abi Enter value for join_date: 12-may-2000 Enter value for sal: 15000 old 1: insert into managers values(&mgr_no,'&mgr_name','&join_date',&sal) new 1: insert into managers values(101,'abi','12-may-2000',15000) 1 row created. SALES_DIVISIONS TABLE CREATION:

SQL> create table sales_divisions(dvn_no number(2),dvn_name varchar(14),location varchar(10)); Table created. INSERT VALUES: SQL> insert into sales_divisions values(&dvn_no,'&dvn_name','&location'); Enter value for dvn_no: 1 Enter value for dvn_name: sales Enter value for location: chennai old 1: insert into sales_divisions values(&dvn_no,'&dvn_name','&location') new 1: insert into sales_divisions values(1,'sales','chennai') 1 row created. DATABASE DESCRIPTION: SQL> desc sales_reps; Name Null? Type ----------------------------------------- -------- ---------------------------REP_ID NUMBER(4) NAME VARCHAR2(10) JOB VARCHAR2(10) MGR_NO NUMBER(5) JOIN_DATE DATE SAL NUMBER(7,2) COMMISION NUMBER(7,2) DVN_NO NUMBER(2) SQL> desc managers; Name Null? Type ----------------------------------------- -------- ---------------------------MGR_NO NUMBER(5) MGR_NAME VARCHAR2(15) JOIN_DATE DATE SAL NUMBER(9,2) SQL> desc sales_divisions; Name Null? Type ----------------------------------------- -------- ---------------------------DVN_NO NUMBER(2) DVN_NAME VARCHAR2(14) LOCATION VARCHAR2(10) DATABASE ENTRIES:

SQL> select * from sales_reps; REP_ID NAME JOB MGR_NO JOIN_DATE SAL COMMISION ---------- ---------- ---------- ---------- --------- ---------- ---------DVN_NO ---------1 tamil executive 101 17-JUL-81 5000 1500 1 2 kousi 32 3 mano 13 4 visa 15 5 megala 32 6 deepa 43 assistant assistant 102 18-MAR-81 103 02-JAN-87 4500 4000 1000 750

steno typist rep

101 13-FEB-90 102 10-APR-81 102 20-FEB-81

3000 2000 3500

400 500 1500

7 aaa 32

executive

101 30-APR-81

4000

2000

7 rows selected. SQL> select * from sales_divisions; DVN_NO DVN_NAME ----------------------13 marketing 15 purchase 43 hr 32 account 1 sales SQL> select * from managers; MGR_NO ---------102 103 MGR_NAME JOIN_DATE SAL -------------------------------karthick 03-JUN-80 12000 priya 20-JAN-89 8000 LOCATION ---------erode coimbatore chennai salem Chennai

5 101 CASE 1: create a query to display all data from the sales_reps table.separate each column by a comma.Name the column in THE_OUTPUT. SQL> select rep_id||','||name||','||job||','||mgr_no||','||join_date||','||sal||','||commision||','| |','||dvn_no as THE_OUTPUT from sales_reps; THE_OUTPUT -------------------------------------------------------------------------------1,tamil,executive,101,17-JUL-81,5000,1500,,1 2,kousi,assistant,102,18-MAR-81,4500,1000,,32 3,mano,assistant,103,02-JAN-87,4000,750,,13 4,visa,steno,101,13-FEB-90,3000,400,,15 5,megala,typist,102,10-APR-81,2000,500,,32 6,deepa,rep,102,20-FEB-81,3500,1500,,43 7,aaa,executive,101,30-APR-81,4000,2000,,32 7 rows selected. CASE 2: Display employee name,job and start date of employees hired between February20,81 and may1,81.order the query in ascending order by start date. SQL> select name,job,join_date from sales_reps where join_date between '20-feb-81' and '1-may-81' order by join_date; NAME ---------deepa kousi megala aaa JOB ---------rep assistant typist executive JOIN_DATE --------20-FEB-81 18-MAR-81 10-APR-81 30-APR-81 abi 12-MAY-00 15000

CASE 3: For each employee display the employee name and calculate the number of months between today and the date the employee was hired.Label the column MONTHS_WORKED.Order your results by the number of months employed.Round the number of months up to the closest whole number.

SQL> select name,join_date,trunc(months_between(sysdate,join_date))months_worked from sales_reps order by months_worked; NAME --------visa mano tamil aaa megala kousi deepa JOIN_DATE --------13-FEB-90 02-JAN-87 17-JUL-81 30-APR-81 10-APR-81 18-MAR-81 20-FEB-81 MONTHS_WORKED ------------217 254 320 322 323 324 324

7 rows selected. CASE 4: Create a query that will display the employee name,department number and all the employees that work in the same department as a given employee. SQL> select distinct s1.dvn_no DEPARTMENT,s1.name,s2.name COLLEAGUE from sales_reps s1,sales_reps s2 where s1.dvn_no=s2.dvn_no and s1.name not in(s2.name); DEPARTMENT ---------32 32 32 32 32 32 6 rows selected. CASE 5: Display the higest,lowest,sum and average salary of all employees.Label the columns maximum,minimum,sum and average respectively.Round your results to the nearest whole number. SQL> select max(sal) maximum,min(sal) minimum,sum(sal) sum,round(avg(sal),2) average from sales_reps; MAXIMUM MINIMUM SUM AVERAGE NAME COLLEAGUE ------------------kousi megala megala aaa kousi aaa aaa kousi megala kousi aaa megala

7 ---------5000 CASE :6 ---------2000 ---------26000 ---------3714.29

Display the manager number and salary of the lowest paid employee for that manager.Exclude any one whose manager is not known.Exclude any groups where the minimum salary is greater than $1000.sort the output in descending order of salary. SQL> select m.mgr_no,min(s.sal)from managers m,sales_reps s group by m.mgr_no having min(s.sal)>1000 and m.mgr_no IS NOT NULL order by min(s.sal)desc; MGR_NO ---------102 103 101 MIN(S.SAL) ---------2000 2000 2000

CASE 7: Write a query to display the department name,location name,number of employees and average salary for all employees in the department.Label the columns DVN_NAME,LOCATION,NO_OF_PEOPLE,SALARY respectively.Round the average salary to 2 decimal place. SQL> select d.dvn_name,d.location,count(r.rep_id)no_of_people,round(avg(r.sal),2)salary from sales_divisions d,sales_reps r where d.dvn_no=r.dvn_no group by dvn_name,location; DVN_NAME -------------account sales marketing purchase hr LOCATION NO_OF_PEOPLE --------------------salem 3 chennai 1 erode 1 coimbatore 1 chennai 1 SALARY ---------3500 5000 4000 3000 3500

CASE 8: Create a query that will display the total number of employees and of that total number who were hired in 1980,1981,1982 and 1983. SQL> select count(*)"total", 2 sum(DECODE(to_char(join_date,'yy'),'80',1,0))"1980", 3 sum(DECODE(to_char(join_date,'yy'),'81',1,0))"1981",

8 4 5 sum(DECODE(to_char(join_date,'yy'),'82',1,0))"1982", sum(DECODE(to_char(join_date,'yy'),'83',1,0))"1983" from sales_reps; total 1980 1981 1982 1983 ---------- ---------- ---------- ---------- ---------7 0 5 0 0

RESULT: Thus the SQL commands for DDL, DML, and DCL was executed successfully.

Ex. No:2 Date:

IMPLEMENTATION OF NORMALIZATION

AIM: To implement normalization concept using database applications. ALGORITHM: Step 1: Start the program. Step 2: Apply I Normal form to the given relational scheme which split the value in the table to atomic values. Step 3: Apply II Normal form to the result of I normal form which eliminates partial dependency. Step 4: Finally, apply III Normal form to the result of II normal form which avoids transitive dependency. Step5: Stop.

IMPLEMENTATION OF NORMALIZATION

10

3NF NORMAL FORM: TABLE CREATION: SQL> create table banker_info(cname varchar(20),brname varchar(20),baname varchar(20),office_no numeric(4)); Table created. INSERT VALUES: SQL> insert into banker_info values('xxx','perryridge','raj',20); SQL> insert into banker_info values('yyy','perryridge','raj',20); SQL> insert into banker_info values('xyz','downtown','ravi',21); SQL> insert into banker_info values('abc','brooklyn','abishek',22); OUTPUT BEFORE NORMALIZATION: SQL> select * from banker_info; CNAME BRNAME -------------------- -------------------xxx perryridge yyy perryridge xyz downtown abc brooklyn DECOMPOSITION: TABLE CREATION:TABLE1: SQL> create table banker_office(baname varchar(20),brname varchar(20), office_no numeric(4)); Table created. INSERT VALUES: SQL> insert into banker_office values('raj','perryride',20); SQL> insert into banker_office values('ravi','downtown',21); SQL> insert into banker_office values('abishek','brooklyn',22); OUTPUT-AFTER NORMALIZATION: BANAME -------------------raj raj ravi abishek OFFICE_NO ---------20 20 21 22

11 SQL> select * from banker_office; BANAME BRNAME -------------------- -------------------raj perryride ravi downtown abishek brooklyn OFFICE_NO ---------20 21 22

TABLE CREATION:TABLE 2: SQL> create table banker_schema(cname varchar(20),brname varchar(20),baname varchar(20)); Table created.

INSERT VALUES: SQL> insert into banker_schema values('xxx','perryride','raj'); SQL> insert into banker_schema values('yyy','perryride','raj'); SQL> insert into banker_schema values('xyz','downtown','ravi'); SQL> insert into banker_schema values('abc','brooklyn','abishek'); OUTPUT-AFTER NORMALIZATION: SQL> select * from banker_schema; CNAME BRNAME BANAME -------------------- -------------------- -------------------xxx perryride raj yyy perryride raj xyz downtown ravi abc brooklyn abishek LOSSLESS-JOIN-OUTPUT: SQL> select banker_schema.cname,banker_office.brname,banker_office.baname,banker_office.office_no from banker_office,banker_schema where banker_office.baname=banker_schema.baname; CNAME BRNAME BANAME -------------------- -------------------- -------------------OFFICE_NO ----------

12 xxx yyy xyz abc perryride perryride downtown brooklyn raj raj ravi abishek 20 20 21 22

BCNF NORMAL FORM: TABLE CREATION: SQL> create table loan_info(bname varchar(20),cname varchar(20),loan_no varchar(20),amount numeric(10,2)); Table created.

INSERT VALUES: SQL> insert into loan_info values('downtown','yyy','1-50',10000); SQL> insert into loan_info values('downtown','xxx','1-50',10000); SQL> insert into loan_info values('perryride','xyz','1-52',12000); SQL> insert into loan_info values('perryride','abc','1-52',12000); SQL> insert into loan_info values('downtown','vinith','1-54',10000);

OUTPUT-BEFORE NORMALIZATION: SQL> select * from loan_info; BNAME CNAME LOAN_NO AMOUNT -------------------- -------------------- -------------------- ---------downtown yyy 1-50 10000 downtown xxx 1-50 10000 perryride xyz 1-52 12000 perryride abc 1-52 12000 downtown vinith 1-54 10000

DECOMPOSITION:

13 TABLE CREATION:TABLE 1: SQL> create table loan_schema(loan_no varchar(20),bname varchar(20),amount number(10)); Table created. INSERT VALUES: SQL> insert into loan_schema values('1-52','perryride',12000); SQL> insert into loan_schema values('1-54','downtown',10000); SQL> insert into loan_schema values('1-50','downtown',10000); OUTPUT AFTER NORMALIZATION: SQL> select * from loan_schema; LOAN_NO BNAME -------------------- -------------------1-52 perryride 1-54 downtown 1-50 downtown TABLE CREATION:TABLE 2: SQL> create table borrower(customer_name varchar(20),loan_number varchar(20)); Table created. INSERT VALUES: SQL> insert into borrower values('xxx','1-50'); SQL> insert into borrower values('yyy','1-50'); SQL> insert into borrower values('xyz','1-52'); SQL> insert into borrower values('vinith','1-54'); SQL> insert into borrower values('abc','1-52'); AMOUNT ---------12000 10000 10000

14 OUTPUT AFTER NORMALIZATION: SQL> select * from borrower; CUSTOMER_NAME -------------------xxx yyy xyz vinith abc LOAN_NUMBER -------------------1-50 1-50 1-52 1-54 1-52

LOSSLESS JOIN-OUTPUT(BCNF): SQL> select loan_schema.loan_no,loan_schema.bname,loan_schema.amount,borrower.customer_name from loan_schema,borrower where loan_schema.loan_no=borrower.loan_number; LOAN_NO BNAME -------------------- -------------------1-50 downtown 1-50 downtown 1-52 perryride 1-54 downtown 1-52 perryride AMOUNT CUSTOMER_NAME ----------------------------10000 xxx 10000 yyy 12000 xyz 10000 vinith 12000 abc

RESULT: Thus the normalization has been implemented successfully by using relational schema.

15 Ex. No:3 Date: IMPLEMENTATION OF INVENTORY CONTROL SYSTEM

AIM: To develop a package to implement the inventory control system. ALGORITHM: Step 1: Create the required tables. Step 2: Create a form to view the details of the item Step 3: Create a form to enter purchase details and update purchase table Step 4: create a form to enter sales details, during sales, quality to be sold is compared with existing quantity. a. b. c. If existing qty>= sales qty, signal success If sales is success, reorder level is checked If existing qty< reorder level, warning message to purchase is display

Step 5: Create the reports Step 6: Stop

16 INVENTORY CONTROL SYSTEM Purchase Form Dim data As New Class1 Private Sub Command1_Click() Dim t As Integer Dim qty As Integer data.connect1 While (data.rsmast.EOF = False) If (data.rsmast!itemcode = Text1.Text) Then data.rsmast.Edit qty = Val(Text2.Text) t = data.rsmast!quandity t = t + qty data.rsmast!quandity = t data.rsmast.Update MsgBox ("done") data.rspur.AddNew data.rspur!itemcode = Text1.Text data.rspur!quandity = Text2.Text data.rspur!pdate = Text3.Text data.rspur!price = Val(Text4.Text) data.rspur.Update End If data.rsmast.MoveNext Wend End Sub Private Sub Command2_Click() Unload Me End Sub

17 Main Form Private Sub Command1_Click() Form1.Show End Sub Private Sub Command2_Click() Form3.Show End Sub Private Sub Command3_Click() DataReport1.Show End Sub Sales Form Dim data As New Class1 Private Sub Command1_Click() Dim t As Integer Dim qty As Integer data.connect1 While (data.rsmast.EOF = False) If (data.rsmast!itemcode = Text1.Text) Then data.rsmast.Edit qty = Val(Text2.Text) t = data.rsmast!quandity If (data.rsmast!reordel >= t) Then MsgBox ("Stock reached reorder level. Please Make purchase") End If If t < qty Then MsgBox ("Item not in stock ! Reorder...") Exit Sub End If t = t - qty data.rsmast!quandity = t data.rsmast.Update data.rssal.AddNew data.rssal!itemcode = Text1.Text data.rssal!quandity = Text2.Text data.rssal!sdate = Text3.Text data.rssal!price = Val(Text4.Text) data.rssal.Update MsgBox ("done") End If data.rsmast.MoveNext Wend End Sub Private Sub Command2_Click() Unload Me End Sub

18 OUTPUT:

Main Stock Form

19 Purchase Entry

Sales Entry

20

RESULT: Thus the package for inventory control system was created successfully.

21

Ex. No:4 Date:

IMPLEMENTATION OF BANKING SYSTEM

AIM: To develop a package to implement the banking system ALGORITHM: Step 1: Start the program Step 2: Create required tables Step 3: Create form to view the details of the customer Step 4: Create a form to add a new account; this account holder may be an existing customer or a new customer. Add the required fields accordingly. Step 5: Create a form to enter loan details. The Loan type may be Car, Home or Personal Step 6: Create Reports to view customers details, account detail and loan detail Step 7: Stop Loan.

22 Withdrawal / Deposit Dim db As Database Dim rs As Recordset Dim rs1 As Recordset Private Sub Command1_Click() rs.AddNew rs!accno = Text1.Text rs!amount = Val(Text2.Text) If (Option1) Then rs!acctype = "sb" Else rs!acctype = "cr" End If If (Option3) Then rs!trans_type = "dep" Else rs!trans_type = "with" End If rs!trans_date = Text3.Text rs!amount = Val(Text2.Text) ' To modify account table ....!!!!! While (Trim(rs1!accno) <> Trim(Text1.Text)) And (Trim(rs1!acctype) <> Trim(rs!acctype)) rs1.MoveNext Wend If (rs1.EOF = True) Then MsgBox ("The Account no longer exists...!!") Unload Me End If rs1.Edit If (Option3) Then rs1!balance = rs1!balance + Val(Text2.Text) Else rs1!balance = rs1!balance - Val(Text2.Text) End If rs1.Update rs1.MoveFirst Command1.Enabled = False End Sub Private Sub Command2_Click() rs1.Close rs.Close db.Close

23 Unload Me End Sub Private Sub Command3_Click() rs.Update Command1.Enabled = True End Sub Private Sub Command4_Click() DataReport1.Show End Sub Private Sub Form_Load() Set db = OpenDatabase("g:\lab\oracle\banking\bank.mdb") Set rs = db.OpenRecordset("trans") Set rs1 = db.OpenRecordset("account") End Sub Private Sub Option4_Click() End Sub Customer Maintenace Dim db As Database Dim rs As Recordset Private Sub Command1_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" End Sub Private Sub Command2_Click() rs.MoveLast rs.AddNew rs!custid = Text1.Text rs!accno = Text6.Text rs!acctype = Text5.Text rs!branch_name = Text4.Text rs!balance = Text3.Text rs!cust_name = Text2.Text rs.Update End Sub

24 Private Sub Command3_Click() Adodc1.Recordset.Delete Adodc1.Recordset.Update MsgBox "done" End Sub Private Sub Command4_Click() rs.Close db.Close Unload Me End Sub Private Sub Form_Load() Set db = OpenDatabase("g:\lab\oracle\banking\bank.mdb") Set rs = db.OpenRecordset("account") End Sub

25 OUTPUT:

Banking Main Form

26 Customer Maintenance

27

RESULT: Thus the package for banking system was created successfully.

28 Ex. No: 5 Date: IMPLEMENTATON OF PAYROLL SYSTEM

AIM: To develop a package to implement the payroll system. ALGORITHM: Step 1: Start the program Step 2: Create Employee tables and leave table with required fields Step 3: Create form to add the details of an employee and update employee table. Step 4: Create a form to view the details of an employee.. Step 5: Create form to enter the leave details of an employee, if casual leave > 12 or earned leave > 30 or Medical leave >12 then an error message should be display accordingly. a. b. Step 6: Create the following reports Pay slips Leave Report Step 7: Stop

29 Employee Maintenance Public db As Database Public rs As Recordset Private Sub Command1_Click() Command1.Enabled = False Text1.Text = "" Text2.Text = "" Text15.Text = "" Text14.Text = "" Text13.Text = "" Text12.Text = "" Text11.Text = "" Text10.Text = "" Text9.Text = "" Text8.Text = "" Text7.Text = "" Text6.Text = "" Text1.SetFocus End Sub Private Sub Command2_Click() rs.AddNew rs!emp_id = Text1.Text rs!emp_name = Text2.Text rs!destination = Text15.Text rs!address1 = Text14.Text rs!address2 = Text13.Text rs!department = Text12.Text rs!experience = Val(Text11.Text) rs!basic = Val(Text10.Text) rs!da = Val(Text9.Text) rs!hra = Val(Text8.Text) rs!pf = Val(Text7.Text) rs!loan = Val(Text6.Text) ' !other_allowances = "" ' !other_deduction = "" rs.Update rs.Close Unload Me End Sub Private Sub Command3_Click() Data1.Recordset.Delete Unload Me End Sub

30 Private Sub Form_Load() Set db = OpenDatabase("g:\lab\oracle\payroll\employee.mdb") Set rs = db.OpenRecordset("emp") End Sub Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single) End Sub Dim ldb As Database Dim lrs As Recordset Private Sub edetail_Click() Form1.Show End Sub Private Sub le_Click() Form2.Show End Sub Private Sub lr_Click() Dim rs2 As Recordset DataReport2.Show End Sub Private Sub MDIForm_Load() End Sub Private Sub pslip_Click() Open "repfile.txt" For Output As #2 Dim d As Date Dim gros As Single Dim netexp As Single Dim rs1 As Recordset Set rs1 = Form1.rs Dim dt As String Dim da1 As Single Dim pf1 As Single

31

Report Generation While (Not rs1.EOF) Print #2, "ANNA UNIVERSITY, CHENNAI" Print #2, " PAY SLIP" Print #2, "Name :" + rs1!emp_name Print #2, "Designation:" + rs1!destination Print #2, "Department :" + rs1!department da1 = rs1!da / 100 * rs1!basic gros = da1 + rs1!hra + rs1!basic pf1 = rs1!pf / 100 * rs1!basic Print #2, "--------------------------------------------" Print #2, "Basic :" + Str(rs1!basic) Print #2, "DA :" + Str(da1) Print #2, "HRA :" + Str(rs1!hra) Print #2, "GROSS :" + Str(gros) Print #2, "PF :" + Str(rs1!pf) + "%" Print #2, "Loan :" + Str(rs1!loan) netexp = pf1 + (rs1!loan) Print #2, "" Print #2, "Net Salary:" + Str(gros - netexp) Print #2, "============================================" Print #2, Print #2, Print #2, 'Print #2, "DA :" + rs1!da rs1.MoveNext Wend Close #2 rs1.Close End Sub

32 Employee Leave Processing Private Sub Command1_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" End Sub Private Sub Command2_Click() Adodc1.Recordset.MoveLast Adodc1.Recordset.AddNew Adodc1.Recordset!empid = Text1.Text Adodc1.Recordset!leavetype = Text2.Text Adodc1.Recordset!availed = Val(Text3.Text) Adodc1.Recordset.Update Command1.Enabled = True End Sub Private Sub Command4_Click() resp = MsgBox("Sure?", vbYesNo) If (resp = 6) Then Adodc1.Recordset.Delete Adodc1.Recordset.Update End If End Sub Private Sub Form_Load() End Sub

33

OUTPUT:

34

35

36

37

38

RESULT: Thus the package for payroll management system was created successfully.

39

Ex. No:6 Date: AIM:

IMPLEMENTATON OF LIBRARY MANAGEMENT SYSTEM

To develop a package that maintains Library transaction information.

ALGORITHM: Step 1: Start the program Step 2: Create Library tables and required fields Step 3: Create form to add the details of students, staff and books. Step 4: Create a form to view the details of students, staff and books. Step 5: Create form to receive and return books. Step 6: Create the reports Step 7: Stop

40 IMPLEMENTATION USING SQL: SQL> create table bookdetails (bookname varchar2(20), bookid number(6),author varchar2(20),publisher varchar2(20)); Table created. SQL> select * from bookdetails; BOOK NAME DBMS OOAD OS BOOK ID 0123 3456 0987 AUTHOR Elmasri Ali Bharami Dhotre PUBLISHER KK publisher JR publisher GK publisher

SQL> create table memberdetails(book_id number(6),member_name varchar2(20),member_id number(6),course varchar2(5),phone_no number(10)); Table created. SQL> select * from memberdetails; BOOK ID 0123 3456 0987 MEMBER NAME Preethi Priya Sree MEMBER ID 12 24 36 COURSE B.TECH IT ECE CSE PHONE NO 9994611398 9994883559 9940942039

SQL> create table transact(transactionid number(5),bookid number(7),memberid number(6),dateofissue varchar2(15),returndate varchar2(15)); Table created. SQL> select * from transactiondetails; TRANSACTON_ID 101 102 103 BOOK_ID 0123 3456 0987 MEMBER_ID 12 24 36 DATE OF ISSUE 4 April 08 5 April 08 6 April 08 RETURN DATE 4 May 08 5 May 08 6 May 08

41 Private Sub Command1_Click() Form3.Show End Sub Private Sub Command2_Click() End End Sub Private Sub Command1_Click() If ((Text1.Text = "LIBRARY") And (Text2.Text = " SYSTEM")) Then MsgBox " WELCOMES YOU " Form1.Show Else MsgBox "User Not Found End If Private Sub Command2_Click() End End Sub Private Sub Command1_Click() Form3.Show End Sub Private Sub Command2_Click() Form2.Show End Sub Private Sub Command3_Click() Form4.Show End Sub Private Sub Command1_Click() Adodc2.Recordset.AddNew End Sub Private Sub Text4_KeyPress(KeyAscii As Integer) If KeyAscii < 48 Or KeyAscii > 57 Then MsgBox "PLZ ENTER THE NUMBER" KeyAscii = 0 End If End Sub Private Sub Command2_Click() Adodc2.Recordset.Delete

42 Adodc2.Recordset.MoveNext End Sub Private Sub Command3_Click() Adodc2.Recordset.Update Adodc2.Recordset.MoveNext End Sub Private Sub Command5_Click() Adodc2.Recordset.MoveNext End Sub Private Sub Command6_Click() Adodc2.Recordset.MovePrevious End Sub Private Sub Command4_Click() Form1.Show End Sub Private Sub Command4_Click() Form1.Show End Sub Private Sub Command1_Click() Adodc1.Recordset.AddNew End Sub Private Sub Command2_Click() Adodc1.Recordset.Delete Adodc1.Recordset.MoveNext End Sub Private Sub Command3_Click() Adodc1.Recordset.Update Adodc1.Recordset.MoveNext End Sub Private Sub Command5_Click() Adodc1.Recordset.MovePrevious End Sub Private Sub Command6_Click() Adodc1.Recordset.MoveNext End Sub

43 Private Sub Command1_Click() Adodc1.Recordset.AddNew End Sub Private Sub Command2_Click() Adodc1.Recordset.Delete Adodc1.Recordset.MoveNext End Sub Private Sub Command3_Click() Adodc1.Recordset.Update Adodc1.Recordset.MoveNext End Sub Private Sub Command5_Click() Adodc1.Recordset.MovePrevious End Sub Private Sub Command6_Click() Adodc1.Recordset.MoveNext End Sub Private Sub Command4_Click() End End Sub

44 OUTPUT:

45

RESULT: Thus the package for Library Management System was created successfully.

46

Ex. No:7 Date:

IMPLEMENTATON OF STUDENT INTERNAL MARKS CALCULATION

AIM: To develop a package to implement student internal marks calculation. ALGORITHM: Step 1: Start the program Step 2: Create Student tables and required fields Step 3: Create form to add the details of students and update student table. Step 4: Create a form to view the details of students. Step 5: Create form to enter the internal marks Step 6: Create the reports Step 7: Stop

47 Internal Mark Calculation Attributes and Properties Form Object Dim m1 As Single, m2 As Single, m3 As Single, attend As Single, imark As Single Dim big1 As Single, big2 As Single, temp As Single Private Sub Command1_Click() If (Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Or Text7.Text = "") Then MsgBox "Properly enter all test marks and attendance" Exit Sub End If m1 = Val(Text4.Text) m2 = Val(Text5.Text) m3 = Val(Text6.Text) attend = Val(Text7.Text) If (m1 > m2) Then big1 = m1 If (m2 > m3) Then big2 = m2 Else big2 = m3 End If Else big1 = m2 If (m1 > m3) Then big2 = m1 Else big2 = m3 End If End If temp = ((big1 + big2) / 200) * 15 If attend > 90 Then temp = temp + 5 End If If attend >= 80 And attend <= 90 Then temp = temp + 4 End If If attend >= 70 And attend < 80 Then temp = temp + 3 End If Text8.Text = Str(temp) End Sub

48

Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" End Sub

49 OUTPUT:

Internal Mark Calculation

RESULT: Thus the package for internal mark calculation was created successfully.

50 Ex. No:8 Date: IMPLEMENTATON OF INCOME TAX CALCULATION

AIM: To develop a package to implement income tax calculation. ALGORITHM: Step 1: Start the program Step 2: Create Employee tables and table with required fields Step 3: Create form to add the details of an employee and income tax calculation.. Step 4: Create a form to view the details of an employee incomes. Step 5: Create form to enter the income details of an employee, if income < 300000 and income >=300000 and 1500000. Step 6: Create the reports Step 7: Stop

51 Main Form Objects Properties and Methods Dim temp As String Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) temp = Adodc1.Recordset!gender If Trim(temp) = "m" Then Option1.Value = True Else Option2.Value = True End If End Sub Private Sub Command1_Click() Dim dob As Date Dim taxamount As Single Dim income As Double Dim invest As Single Dim taxable As Single Dim tax dob = Text2.Text Dim age As Single age = Math.Abs(DateValue(dob) - Now) / (30 * 12) income = Val(Text3.Text) invest = Val(InputBox("Investment amount")) If (invest > 100000) Then invest = 100000 End If taxamount = income - invest tax = 0 Select Case Option1.Value Case True: If age < 59.99 Then taxable = taxamount - 150000 If (taxable <= 300000 And taxable > 150000) Then tax = taxable * 10 / 100 End If If (taxable > 300000) Then tax = taxable * 30 / 100 End If Else taxable = taxamount - 250000

52 If (taxable <= 300000) Then tax = taxable * 10 / 100 End If If (taxable > 300000 And taxable > 150000) Then tax = taxable * 30 / 100 End If End If Case False: If age < 59.99 Then taxable = taxamount - 175000 If (taxable <= 300000 And taxable > 150000) Then tax = taxable * 10 / 100 End If If (taxable > 300000) Then tax = taxable * 30 / 100 End If Else taxable = taxamount - 275000 If (taxable <= 300000 And taxable > 150000) Then tax = taxable * 10 / 100 End If If (taxable > 300000) Then tax = taxable * 30 / 100 End If End If End Select Open "taxfile.txt" For Output As #1 Print #1, "PAN NO :", Text4.Text Print #1, "Name :", Text1.Text Print #1, "Annual income :", Text3.Text Print #1, "Taxable ampunt:", taxable Print #1, "Tax :", tax Close #1 End Sub Private Sub Form_Load() temp = Adodc1.Recordset!gender If Trim(temp) = "m" Then Option1.Value = True Else Option2.Value = True End If End Sub

53

OUTPUT:

RESULT: Thus the package for income tax calculation was created successfully.

Вам также может понравиться