0% found this document useful (0 votes)
12 views24 pages

Font and Calculator Application Code

The document describes code for a notepad application that allows users to create, open, save, print and edit text files using a rich text box. It includes menu options for common editing functions like cut, copy, paste as well as file operations like new, open, save and print.

Uploaded by

dangerkaiiyt2005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views24 pages

Font and Calculator Application Code

The document describes code for a notepad application that allows users to create, open, save, print and edit text files using a rich text box. It includes menu options for common editing functions like cut, copy, paste as well as file operations like new, open, save and print.

Uploaded by

dangerkaiiyt2005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

FONT APPLICATION

Public Class Form1


Private Sub BOLD_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = New [Link]([Link],
[Link])
End Sub

Private Sub ITAIC_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = New [Link]([Link],
[Link])
End Sub

Private Sub UNDERLINE_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = New [Link]([Link],
[Link])
End Sub

Private Sub STRIKEOUT_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = New [Link]([Link],
[Link])
End Sub

Private Sub REGULAR_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = New [Link]([Link],
[Link])
End Sub

Private Sub LEFT_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = [Link]
End Sub

Private Sub RIGHT_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = [Link]
End Sub

Private Sub CENTER_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = [Link]
End Sub

Private Sub COLOR_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
[Link] = [Link]
End Sub

Private Sub STYLE_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
[Link] = [Link]

End Sub

Private Sub CLEAR_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub EXIT_EXIT_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles EXIT_EXIT.Click
End
End Sub
End Class

CALCULATOR

Public Class Form1

Dim RESULT As Double = 0


Private Sub ONE_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub TWO_Click(ByVal sender As Object, ByVal e As [Link])


Handles [Link]
[Link] += [Link]
End Sub

Private Sub THREE_Click(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub FOUR_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub FIVE_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub SIX_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub SEVEN_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub EIGHT_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub NINE_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub DOT_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub ZERO_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub DBLZERO_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub PLUS_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub MINUS_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub MUL_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub DIV_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub OPEN_PARAN_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub CLOSE_PARAN_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] += [Link]
End Sub

Private Sub EQUALTO_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim TEMP, OPE As String
TEMP = [Link]
Dim LEN As Double
LEN = [Link] - 1
OPE = [Link](LEN)
If OPE = "+" Or OPE = "-" Or OPE = "*" Or OPE = "/" Or OPE = "(" Then
MsgBox("SYNTAX ERROR")
Else
RESULT = New DataTable().Compute(TEMP, Nothing)
[Link] = RESULT
End If
End Sub

Private Sub CLEAR_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = ""
End Sub
End Class
DIGITAL CLOCK

Public Class Form1

Dim hr, mins, sec, msec As Integer

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()

End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = ""
hr = 0
mins = 0
sec = 0
msec = 0
[Link]()

End Sub

Private Sub Button4_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
h: hr = InputBox("Enter the hour value:")
If hr >= 24 Then
MsgBox("Enter the valid value:")
GoTo h
Else
m: mins = InputBox("Enter the minute value:")
If mins >= 60 Then
MsgBox("Enter valid value")
GoTo m
Else
s: sec = InputBox("Enter the second value:")
If sec >= 60 Then
MsgBox("Enter valid value")
GoTo s
Else
ms: msec = InputBox("Enter the millisecond value:")
If msec >= 100 Then
MsgBox("Enter valid value")
GoTo ms
End If
End If
End If
End If
[Link]()
End Sub

Private Sub Button5_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
End
End Sub

Private Sub Timer1_Tick(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
msec = msec + 1
If msec >= 100 Then
msec = 0
sec = sec + 1
If sec >= 60 Then
sec = 0
mins = mins + 1
If mins >= 60 Then
mins = 0
hr = hr + 1
If hr >= 24 Then
hr = 0
mins = 0
sec = 0
msec = 0
End If
End If
End If
End If
[Link] = hr & " : " & mins & " : " & sec & " : " & msec
End Sub
End Class

NOTEPAD

Public Class Form1


Dim temp, str As String
Private Sub NewToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As
[Link]) Handles [Link]
[Link] = ""
[Link] = [Link]
[Link] = [Link]
End Sub

Private Sub OpenToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
[Link]([Link],
[Link])
End Sub

Private Sub SaveToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
[Link]([Link],
[Link])
End Sub

Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]
[Link]()
[Link]([Link],
[Link])
End Sub

Private Sub PrintToolStripMenuItem2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As [Link], ByVal


e As [Link]) Handles [Link]
[Link]()
End Sub

Private Sub ExitToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
End
End Sub

Private Sub CutToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub CopyToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub PasteToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub RedoToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub UndoToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
End Sub

Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]
[Link]()
End Sub

Private Sub DeleteToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = ""
End Sub

Private Sub FindToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
str = InputBox("Enter the string to find:")
temp = [Link](str, 0, Len([Link]), 1)
If temp >= 0 Then
MsgBox("The string is found")
Else
MsgBox("The string is not found")
End If
End Sub

Private Sub ReplaceToolStripMenuItem1_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]
str = InputBox("Enter the string to replace:")
[Link] = str
End Sub

Private Sub FontToolStripMenuItem_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
[Link] = [Link]
End Sub

Private Sub ForeColorToolStripMenuItem_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]
[Link]()
[Link] = [Link]
End Sub

Private Sub BackColorToolStripMenuItem_Click(ByVal sender As [Link], ByVal e


As [Link]) Handles [Link]
[Link]()
[Link] = [Link]
End Sub
End Class

STUDENT DETAILS

Public Class Form1


Dim cn As New [Link]
Dim cmd As New [Link]
Dim cnstr, sql As String

Private Sub Button1_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
Dim TOT As Integer
Dim AVG As Double
Dim RES As String
TOT = Val([Link]) + ([Link]) + ([Link]) + ([Link])
[Link] = TOT
AVG = TOT / 4
[Link] = AVG
If (Val([Link]) >= 40 And Val([Link]) >= 40 And ([Link]) >=
40 And ([Link]) >= 40) Then
RES = "PASS"
Else
RES = "FAIL"
End If
[Link] = RES
If AVG >= 90 Then
[Link] = "O"
ElseIf AVG >= 80 Then
[Link] = "A"
ElseIf AVG >= 70 Then
[Link] = "B"
ElseIf AVG >= 60 Then
[Link] = "C"
ElseIf AVG >= 50 Then
[Link] = "D"
ElseIf AVG >= 40 Then
[Link] = "E"
Else
[Link] = "F"

End If
End Sub

Private Sub Button4_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""

End Sub

Private Sub Button5_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
End
End Sub

Private Sub Form1_Load(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
cnstr = "Provider=MSDAORA;Data Source=orcl;User ID=l3221it055;password=kasc"
cn = New [Link](cnstr)

End Sub

Private Sub ComboBox1_GotFocus(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
[Link]()
[Link]()
sql = "select reg_no from student_details"
Dim ocmd As New [Link](sql, cn)
Dim odareader As [Link] = [Link]
While [Link]
[Link]([Link](0).ToString())
End While
[Link]()
[Link]()
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As


[Link]) Handles [Link]
[Link]()
sql = "select * from student_details where reg_no='" + [Link] + "'"
Dim ocmd As New [Link](sql, cn)
Dim odareader As [Link] = [Link]
While [Link]
[Link] = [Link](0).ToString()
[Link] = [Link](1).ToString()
[Link] = [Link](2).ToString()
[Link] = [Link](3).ToString()
[Link] = [Link](4).ToString()
[Link] = [Link](5).ToString()
[Link] = [Link](6).ToString()
[Link] = [Link](7).ToString()
[Link] = [Link](8).ToString()
[Link] = [Link](9).ToString()
[Link] = [Link](10).ToString()

End While
[Link]()
[Link]()

End Sub

Private Sub Button2_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
sql = "insert into student_details values('" + [Link] + "','" + [Link] +
"','" + [Link] + "','" + [Link] + "','" + [Link] + "','" + [Link]
+ "','" + [Link] + "','" + [Link] + "','" + [Link] + "','" +
[Link] + "','" + [Link] + "')"
cmd = New [Link](sql, cn)
[Link]()
[Link]()
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
MsgBox("Record saved")

End Sub

Private Sub Button3_Click(ByVal sender As [Link], ByVal e As


[Link]) Handles [Link]
[Link]()
sql = "delete into student_details where reg_no='" + [Link] + "'"
cmd = New [Link](sql, cn)
[Link]()
[Link]()
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""

MsgBox("Record deleted")

End Sub
End Class

FACULTY

FACULTY
`````````

SQL> desc faculty;


Name Null? Type
----------------------------------------- -------- ----------------------------
F_ID NOT NULL NUMBER(3)
F_NAME VARCHAR2(15)
DEPT VARCHAR2(10)
DESIG VARCHAR2(10)
SALARY NUMBER(5)

SQL> select *from faculty;

F_ID F_NAME DEPT DESIG SALARY


---------- --------------- ---------- ---------- ----------
1 BALZ IT HOD 35000
2 SIVA CT HOD 30000
3 ASH CS HOD 25000
4 KISHORE IT [Link] 25000
5 SIBI IT [Link] 25000
6 RAM CT [Link] 15000
7 KARTHI CS [Link] 10000

7 rows selected.

SQL> insert into faculty values (8,'aadhi','CT','CEO',60000);

1 row created.

SQL> select *from faculty;

F_ID F_NAME DEPT DESIG SALARY


---------- --------------- ---------- ---------- ----------
1 BALZ IT HOD 35000
2 SIVA CT HOD 30000
3 ASH CS HOD 25000
4 KISHORE IT [Link] 25000
5 SIBI IT [Link] 25000
6 RAM CT [Link] 15000
7 KARTHI CS [Link] 10000
8 aadhi CT CEO 60000

8 rows selected.

SQL> select length(f_name) from faculty;

LENGTH(F_NAME)
--------------
4
4
3
7
4
3
6
5

8 rows selected.

SQL> select upper(f_name),lower(dept),initcap(desig) from faculty;


UPPER(F_NAME) LOWER(DEPT INITCAP(DE
--------------- ---------- ----------
BALZ it Hod
SIVA ct Hod
ASH cs Hod
KISHORE it [Link]
SIBI it [Link]
RAM ct [Link]
KARTHI cs [Link]
AADHI ct Ceo

8 rows selected.

SQL> select substr(f_name,0,3) from faculty;

SUB
---
BAL
SIV
ASH
KIS
SIB
RAM
KAR
aad

8 rows selected.
SQL> select replace(dept,'I','C') FROM FACULTY;

REPLACE(DE
----------
CT
CT
CS
CT
CT
CT
CS
CT

8 rows selected.

SQL> select concat(f_id,f_name) from faculty;

CONCAT(F_ID,F_NAME)
-------------------------------------------------------
1BALZ
2SIVA
3ASH
4KISHORE
5SIBI
6RAM
7KARTHI
8aadhi
8 rows selected.

SQL>

SQL> SELECT SUM(SALARY) FROM FACULTY;

SUM(SALARY)
-----------
225000

SQL>
SQL> SELECT AVG(SALARY) FROM FACULTY;

AVG(SALARY)
-----------
28125

SQL> SELECT MAX(SALARY) FROM FACULTY;

MAX(SALARY)
-----------
60000

SQL> SELECT MIN(SALARY) FROM FACULTY;

MIN(SALARY)
-----------
10000
SQL> SELECT DISTINCT DEPT,COUNT(DEPT) FROM FACULTY GROUP BY
DEPT;

DEPT COUNT(DEPT)
---------- -----------
IT 3
CS 2
CT 3

SQL>

STUDENT TABLE

STUDENT TABLE
```````````````

(i) Table Creation


SQL> create table student618(reg_no number(3) primary key, stud_name varchar2(20), class
varchar2(10), dept varchar2(10), college varchar2(10));
Table created.

SQL> desc student618


Name Null? Type
----------------------------------------- -------- ----------------------------
REG_NO NOT NULL NUMBER(3)
STUD_NAME VARCHAR2(20)
CLASS VARCHAR2(10)
DEPT VARCHAR2(10)
COLLEGE VARCHAR2(10)

(ii) Table Alteration


SQL> alter table student618 add mark number(3);
Table altered.
SQL> desc student618
Name Null? Type
----------------------------------------- -------- ----------------------------
REG_NO NOT NULL NUMBER(3)
STUD_NAME VARCHAR2(20)
CLASS VARCHAR2(10)
DEPT VARCHAR2(10)
COLLEGE VARCHAR2(10)
MARK NUMBER(3)
Rows Insertion
SQL> insert into student618 values(&num,'&name','&class','&dept','&college',&mark);
Enter value for num: 101
Enter value for name: JOHN
Enter value for class: II IT
Enter value for dept: IT
Enter value for college: KASC
Enter value for mark: 78
old 1: insert into student618 values(&num,'&name','&class','&dept','&college',&mark)
new 1: insert into student618 values(101,'JOHN','II IT','IT','KASC',78)
1 row created.

SQL> /
Enter value for num: 102
Enter value for name: PETER
Enter value for class: III IT
Enter value for dept: IT
Enter value for college: KASC
Enter value for mark: 78
old 1: insert into student618 values(&num,'&name','&class','&dept','&college',&mark)
new 1: insert into student618 values(102,'PETER','III IT','IT','KASC',78)
1 row created.

SQL> /
Enter value for num: 103
Enter value for name: DAVID
Enter value for class: II CS
Enter value for dept: CS
Enter value for college: KASC
Enter value for mark: 85
old 1: insert into student618 values(&num,'&name','&class','&dept','&college',&mark)
new 1: insert into student618 values(103,'DAVID','II CS','CS','KASC',85)
1 row created.

SQL> /
Enter value for num: 104
Enter value for name: JAMES
Enter value for class: I CT
Enter value for dept: CT
Enter value for college: KASC
Enter value for mark: 85
old 1: insert into student618 values(&num,'&name','&class','&dept','&college',&mark)
new 1: insert into student618 values(104,'JAMES','I CT','CT','KASC',85)
1 row created.

SQL> /
Enter value for num: 105
Enter value for name: CHARLES
Enter value for class: I IT
Enter value for dept: IT
Enter value for college: KASC
Enter value for mark: 82
old 1: insert into student618 values(&num,'&name','&class','&dept','&college',&mark)
new 1: insert into student618 values(105,'CHARLES','I IT','IT','KASC',82)
1 row created.

SQL> SELECT * FROM STUDENT618;


REG_NO STUD_NAME CLASS DEPT COLLEGE MARK
---------- -------------------- ---------- ---------- ---------- ----------
101 JOHN II IT IT KASC 78
102 PETER III IT IT KASC 78
103 DAVID II CS CS KASC 85
104 JAMES I CT CT KASC 85
105 CHARLES I IT IT KASC 82

(iii) Display distinct mark


SQL> SELECT DISTINCT MARK FROM STUDENT618;
MARK
----------
78
85
82

(iv) Retrieve data using WHERE Clause


SQL> SELECT * FROM STUDENT618 WHERE MARK>80;
REG_NO STUD_NAME CLASS DEPT COLLEGE MARK
---------- -------------------- ---------- ---------- ---------- ----------
103 DAVID II CS CS KASC 85
104 JAMES I CT CT KASC 85
105 CHARLES I IT IT KASC 82

SQL> SELECT * FROM STUDENT618 WHERE DEPT='CS' AND MARK>90;

no rows selected

SQL> SELECT * FROM STUDENT618 WHERE DEPT='CS' OR MARK>90;

REG_NO STUD_NAME CLASS DEPT COLLEGE MARK


---------- -------------------- ---------- ---------- ---------- ----------
103 DAVID II CS CS KASC 85
SQL> SELECT * FROM STUDENT618 WHERE REG_NO BETWEEN 101 AND 103;

REG_NO STUD_NAME CLASS DEPT COLLEGE MARK


---------- -------------------- ---------- ---------- ---------- ----------
101 JOHN II IT IT KASC 78
102 PETER III IT IT KASC 78
103 DAVID II CS CS KASC 85

JOIN OPERATIONS
``````````````````

SQL> CREATE TABLE EMPLOYEE(EMP_ID NUMBER(3) PRIMARY KEY,


EMP_NAME VARCHAR2(20), PHONE NUMBER(10), SALARY NUMBER(8));
Table created.

SQL> DESC EMPLOYEE


Name Null? Type
----------------------------------------- -------- ----------------------------
EMP_ID NOT NULL NUMBER(3)
EMP_NAME VARCHAR2(20)
PHONE NUMBER(10)
SALARY NUMBER(8)

SQL> CREATE TABLE DEPARTMENT(DEPT_ID NUMBER(3), DEPT_NAME


VARCHAR2(10), EMP_ID NUMBER(3) REFERENCES EMPLOYEE(EMP_ID),
DESIGNATION VARCHAR2(15));
Table created.

SQL> DESC DEPARTMENT


Name Null? Type
----------------------------------------- -------- ----------------------------
DEPT_ID NUMBER(3)
DEPT_NAME VARCHAR2(10)
EMP_ID NUMBER(3)
DESIGNATION VARCHAR2(15)
SQL> INSERT INTO EMPLOYEE VALUES(101,'AAA',3546787858,25000);
1 row created.

SQL> INSERT INTO EMPLOYEE VALUES(102,'BBB',8765432109,32000);


1 row created.

SQL> INSERT INTO EMPLOYEE VALUES(103,'CCC',7654328901,20000);


1 row created.
SQL> INSERT INTO EMPLOYEE VALUES(104,'DDD',9870642514,32000);
1 row created.

SQL> INSERT INTO EMPLOYEE VALUES(105,'EEE',6389726410,28000);


1 row created.

SQL> INSERT INTO EMPLOYEE VALUES(106,'FFF',5674328901,38000);


1 row created.

SQL> SELECT * FROM EMPLOYEE;


EMP_ID EMP_NAME PHONE SALARY
---------- -------------------- ---------- ----------------------------
101 AAA 3546787858 25000
102 BBB 8765432109 32000
103 CCC 7654328901 20000
104 DDD 9870642514 32000
105 EEE 6389726410 28000
106 FFF 5674328901 38000
6 rows selected.

SQL> INSERT INTO DEPARTMENT VALUES(1,'PRODUCTION',101,'MANAGER');


1 row created.

SQL> INSERT INTO DEPARTMENT VALUES(1,'PRODUCTION',102,'SUPERVISOR');


1 row created.

SQL> INSERT INTO DEPARTMENT VALUES(2,'SALES',103,'MANAGER');


1 row created.

SQL> INSERT INTO DEPARTMENT VALUES(3,'SERVICE',104,'SUPERVISOR');


1 row created.

SQL> INSERT INTO DEPARTMENT VALUES(4,'PURCHASE',105,'EXECUTIVE');


1 row created.

SQL> SELECT * FROM DEPARTMENT;


DEPT_ID DEPT_NAME EMP_ID DESIGNATION
---------- ----------------------------------- ---------- ---------------
1 PRODUCTION 101 MANAGER
1 PRODUCTION 102 SUPERVISOR
2 SALES 103 MANAGER
3 SERVICE 104 SUPERVISOR
4 PURCHASE 105 EXECUTIVE
5 rows selected.

(i) EQUIJOIN
SQL> SELECT * FROM EMPLOYEE E, DEPARTMENT D WHERE
E.EMP_ID=D.EMP_ID;

EMP_ID EMP_NAME PHONE SALARY DEPT_ID DEPT_NAME EMP_ID


DESIGNATION
---------- -------------------- ---------- ---------- ---------- ---------- ----------
--------------------------------------------
101 AAA 3546787858 25000 1 PRODUCTION 101
MANAGER
102 BBB 8765432109 32000 1 PRODUCTION 102
SUPERVISOR
103 CCC 7654328901 20000 2 SALES 103 MANAGER
104 DDD 9870642514 32000 3 SERVICE 104 SUPERVISOR
105 EEE 6389726410 28000 4 PURCHASE 105 EXECUTIVE
5 rows selected.

(ii) NONEQUIJOIN
SQL> SELECT * FROM EMPLOYEE E, DEPARTMENT D WHERE [Link]
BETWEEN 25000 AND 30000;
EMP_ID EMP_NAME PHONE SALARY DEPT_ID DEPT_NAME EMP_ID
DESIGNATION
---------- -------------------------------------------------- ---------- ---------- ---------- ----------
---------- ---------------
101 AAA 3546787858 25000 1 PRODUCTION 101
MANAGER
101 AAA 3546787858 25000 1 PRODUCTION 102
SUPERVISOR
101 AAA 3546787858 25000 2 SALES 103 MANAGER
101 AAA 3546787858 25000 3 SERVICE 104 SUPERVISOR
101 AAA 3546787858 25000 4 PURCHASE 105
EXECUTIVE
105 EEE 6389726410 28000 1 PRODUCTION 101 MANAGER
105 EEE 6389726410 28000 1 PRODUCTION 102
SUPERVISOR
105 EEE 6389726410 28000 2 SALES 103 MANAGER
105 EEE 6389726410 28000 3 SERVICE 104 SUPERVISOR
105 EEE 6389726410 28000 4 PURCHASE 105 EXECUTIVE
10 rows selected.

(iii) SELF-JOIN
SQL> SELECT * FROM EMPLOYEE E, EMPLOYEE F WHERE E.EMP_ID=104;
EMP_ID EMP_NAME PHONE SALARY EMP_ID EMP_NAME
PHONE SALARY
---------- -------------------------------------------- ---------- ---------- ---------- --------------------
---------- ----------
104 DDD 9870642514 32000 101 AAA 3546787858
25000
104 DDD 9870642514 32000 102 BBB 8765432109
32000
104 DDD 9870642514 32000 103 CCC 7654328901
20000
104 DDD 9870642514 32000 104 DDD 9870642514
32000
104 DDD 9870642514 32000 105 EEE 6389726410
28000
5 rows selected.

(iv) OUTER JOIN


SQL> SELECT * FROM EMPLOYEE E, DEPARTMENT D WHERE
E.EMP_ID=D.EMP_ID(+);
EMP_ID EMP_NAME PHONE SALARY DEPT_ID DEPT_NAME EMP_ID
DESIGNATION
---------- -------------------------------------------------- ---------- ---------- ---------- ----------
---------- ---------------
101 AAA 3546787858 25000 1 PRODUCTION 101
MANAGER
102 BBB 8765432109 32000 1 PRODUCTION 102
SUPERVISOR
103 CCC 7654328901 20000 2 SALES 103 MANAGER
104 DDD 9870642514 32000 3 SERVICE 104 SUPERVISOR
105 EEE 6389726410 28000 4 PURCHASE 105 EXECUTIVE
106 FFF 5674328901 38000
6 rows selected.

Common questions

Powered by AI

The document portrays the 'INSERT INTO' command as a straightforward method to enter new data into existing tables. The syntax involves specifying the table name followed by the values to be inserted, with each set of values wrapped in parentheses. For instance, inserting a new faculty member or a new student involves listing each value in sequence as per the table's column order. This process is crucial for adding new records to maintain updated datasets .

The document illustrates SQL join operations through examples of equijoin, nonequijoin, self-join, and outer join. For equijoin, it selects values where employee IDs match in 'EMPLOYEE' and 'DEPARTMENT' tables. A nonequijoin example retrieves 'EMPLOYEE' and 'DEPARTMENT' records where the salary falls between specified ranges. A self-join demonstrates how an employee table can be joined with itself, for example, selecting employees based on their IDs. An outer join example selects records from the 'EMPLOYEE' table with matching records, if any, from the 'DEPARTMENT' table, including unmatched rows from the 'EMPLOYEE' table .

The document describes a basic calculator application interface made up of buttons representing digits and operations. Each button has an event handler that appends the button's text to a 'TextBox'. For example, ONE_Click through NINE_Click add respective digits, while PLUS_Click and MINUS_Click append operation symbols to the 'TextBox'. The interface elements are linked to their functionality via these event handlers to facilitate interactions .

The document showcases database integrity through foreign key constraints in SQL. For instance, the 'EMP_ID' field in the 'DEPARTMENT' table is a foreign key referencing 'EMP_ID' in the 'EMPLOYEE' table, ensuring that any entry in 'DEPARTMENT' must correspond to a valid 'EMP_ID' in 'EMPLOYEE'. This relational integrity constraint prevents orphan records in the 'DEPARTMENT' table, maintaining consistency within the database by disallowing any 'DEPARTMENT' record with a non-existing employee reference .

The document describes the use of the 'ALTER TABLE' command to modify an existing database schema by adding new columns. For instance, in the student table, a 'MARK' column is added using 'ALTER TABLE student618 ADD mark NUMBER(3)'. This command enables dynamic schema updates without recreating the table, facilitating adaptations to changing data requirements without loss of existing data .

The document demonstrates the 'SELECT' statement with various conditions to extract targeted data from a table. For example, 'SELECT * FROM STUDENT618 WHERE MARK>80' retrieves students with marks above 80. The use of conditions like 'BETWEEN', 'AND', 'OR', and comparisons (e.g., greater than) help refine queries to only the relevant rows, effectively enabling precise data retrieval based on specified criteria .

The document effectively demonstrates SQL aggregate functions to process and summarize data within a table. Specifically, 'SUM(SALARY)' calculates the total salary, 'AVG(SALARY)' finds the average salary, 'MAX(SALARY)' and 'MIN(SALARY)' determine the highest and lowest salaries respectively, and 'COUNT(DEPT)' counts the frequency of distinct departments. These aggregate functions are pivotal for compiling comprehensive insights from datasets, as shown in the faculty table's salary analysis .

The document describes implementing text formatting in a graphical user interface (GUI) text editor through several private subroutines within the 'Form1' class. Key functions involved include BOLD_Click, ITAIC_Click, and UNDERLINE_Click, which respectively apply bold, italic, and underline styles to the selected text in a 'RichTextBox' object. Each function uses the 'Drawing.Font' class along with 'Drawing.FontStyle' enumeration to change the font style .

SQL functions such as 'UPPER', 'LOWER', and 'INITCAP' are pivotal for manipulating text data formats. 'UPPER' transforms text to all uppercase letters, 'LOWER' converts text to all lowercase letters, and 'INITCAP' capitalizes the first letter of each word. The document utilizes these functions in select queries to standardize or transform text data for consistent presentation or comparison purposes, as demonstrated with 'f_name' and 'dept' in the faculty table .

The document demonstrates several SQL operations to modify and query a 'faculty' table, showcasing data manipulation skills. Operations include 'INSERT INTO' for adding a new record, 'SELECT * ...', 'SELECT LENGTH(f_name)', and 'SELECT UPPER(f_name)...' for retrieving specific attributes, as well as calculations like 'SELECT SUM(SALARY)', 'SELECT AVG(SALARY)', and 'SELECT COUNT(DEPT)' for aggregate data processing. Furthermore, data manipulation functions such as 'REPLACE', 'CONCAT', and 'SUBSTR' alter and query string data .

You might also like