SQL Create Table Employee (Emp - Salary Number (5), Name Varchar2 (12), Basic - Salary Number (4), Pro - Tax Number (3) )
The document contains SQL statements that create tables, insert data, modify tables, add and update columns, and perform queries. It creates an Employee table with salary and personal details, calculates deductions and additions, and adds a net salary column. It also creates a Student table, inserts marks, calculates totals and percentages, and adds a result column marking students as pass or fail.
SQL Create Table Employee (Emp - Salary Number (5), Name Varchar2 (12), Basic - Salary Number (4), Pro - Tax Number (3) )
The document contains SQL statements that create tables, insert data, modify tables, add and update columns, and perform queries. It creates an Employee table with salary and personal details, calculates deductions and additions, and adds a net salary column. It also creates a Student table, inserts marks, calculates totals and percentages, and adds a result column marking students as pass or fail.
SQL> INSERT INTO Student values(101,'SMIT',80,95,65); SQL> INSERT INTO Student values(102,'Anil',70,86,56); SQL> Select * from student; ROLL_NO NAME SUB1 SUB2 SUB3 ---------- ------------ ---------- ---------- ---------- 101 SMIT 80 95 65 102 Anil 70 86 56 SQL> alter table student add(Total number(4)); SQL> update student SET Total=sub1+sub2+sub3; SQL> alter table student add (Perc number(4)); SQL> update student SET perc=(total/300)*100; SQL> Select * from student; ROLL_NO NAME SUB1 SUB2 SUB3 TOTAL PERC ---------- ------------ ---------- ---------- ---------- ---------- ---------- 101 SMIT 80 95 65 240 80 102 Anil 70 86 56 212 71
SQL> alter table student add (Result varchar2(4));
SQL> UPDATE Student SET result='Pass' Where Sub1>=35 and Sub2>=35 and sub3>=35; SQL> UPDATE Student SET result='Fail' Where Sub1<35 or Sub2<35 or sub3<35; 0 rows updated. SQL> Select * from student; ROLL_NO NAME SUB1 SUB2 SUB3 TOTAL PERC RESU ---------- ------------ ---------- ---------- ---------- ---------- ---------- ---- 101 SMIT 80 95 65 240 80 Pass