Rdbms Practical Program
Rdbms Practical Program
Rdbms Practical Program
1. SQL:
(iv) Updateoperations
Algorithm:
1. Start the Program.
2. Create the table with below field names.
(i) S_No, Primary key
(ii) Name
(iii) Mark
3. Insert into table student.
4. Select the Values for table and display the result.
CODING:
SQL> Create table student (sno number (5) primary key, name varchar (20), mark number (3));
Table created.
SQL>insert into student values (&sno,’&name,’&mark);
Enter value for sno:001
Enter value for name: Ragu
Enter value for mark:75
Old l: insert into student (&sno,’&name’, &mark)
New l: insert into student values (001,’Ragu’, 75)
1 rowcreated
SQL>insert into student values (&sno,’&name,’&mark);
Enter value for sno:002
Enter value for name: Pream
Enter value for mark:85
Old l: insert into student values (&sno,’&name’, &mark)
New l: insert into student values (002,’Pream’, 85)
1 row created
SQL> insert into student values (&sno,’&name,’&mark);
Enter values for sno: 003
Enter values for name: Prasana
Enter value for mark: 95
Old l: insert into student values (&sno,’&name’, &mark)
New l: insert into student values (3,’Prasana’, 95)
1 row created
OUTPUT:
001 Ragu 75
002 Pream 85
003 Prasana 95
RESULT
To create the table & select values using various forms of select Statement.
Algorithm:
1. Start the process.
2. Create the table with table names student and field names sno, name, department, mark.
3. Insert values into the table student using insert query.
4. Select all value from table student where is created.
5. Select all value from table student where department BBA (CA).
6. Select all value from table student where order by mark.
7. Stop the process.
CODING:
SQL>Create table student (sno number (5), name varchar (20), department varchar (5), mark
number (3));
Table created.
SQL>insert into student values (&sno,’&name,’&depatment’&mark);
Enter value for sno: 1
Enter value for name: Rahim
Enter value for department: bca
Enter value for mark: 78
Old l: insert into student (&sno,’&name’,’&department’, &mark)
New l: insert into student values (1,’Rahim’,’bca’78)
1 row created.
SQL> insert into student values (&sno,’&name,’&depatment’&mark);
Enter value for sno: 2
Enter value for name: Ajay
Enter value for department: bba
Enter value for mark: 67
Old l: insert into student values (&sno,’&name’,’&department’, &mark)
New l: insert into student values (2,’Ajay’,’bba’, 67)
1 row created.
SQL> insert into student values (&sno,’&name,’&depatment’&mark);
Enter values for sno: 3
Enter values for name: Kumar
Enter value for department: maths
Enter value for mark: 56
Old l: insert into student values (&sno,’&name’,’&department’, &mark)
New l: insert into student values (3,’Kumar’, maths’, 56)
1 row created.
RESULT:
CODING:
SQL>create table student (sno number (5), name varchar (10));
Table created.
1 Bala
2 Abilash
3 Syed
4 Angel
SQL> create table result (sno number (5), mark varchar (3));
SQL> create table result (sno number (5), mark varchar (3));
OUTPUT:
Table created.
SNO MARK
1 99
2 98
3 97
4 96
SQL>select name from student where sno in (select sno from result where mark>70);
NAME
Bala
Abilash
RESULT:
1.UPDATEOPERATIONS
Aim:
To update existing values in the table using update query.
Algorithm:
1. Select the process.
2. Create the table with table name student and field name sno name using create table query.
3. Insert values to the table student using create table query.
4. Update value name where sno, using update query.
5. Select all the values from table student using select query.
6. Stop the process.
CODING:
SQL> create table student (sno number (5) Primary key, name varchar (20), mark number
(3));
Table created.
OUTPUT:
1.ALTER THEDATABASE
Aim:
To alter existing values in the table using modify and names alter the query.
Algorithm:
1. Select the process.
2. Create a student the process table with field link Reg no, Name, mark1.
3. Insert with value into student table with field link Reg no, Name, mark1, total, average.
4. Alter the table student by adding the new field grade.
5. Using update operation insert the values for the field.
6. Stop the process.
CODING:
SQL>create table student (sno number (5) primary key, name varchar (20), mark number
(3));
Table created.
SQL>desc student;
Algorithm:
2. To create table with table name result from aggregate function with field name sno and marks.
3. Using aggregate function link min, mak, mark, sum, avg, and count using select queries.
4. Using data function link and month between day last day using select from dual queries.
5. Using number function link and mod power round and sort , sin, cos, tan using select from dual query.
CODING:
SQL>select*from result;
OUTPUT:
SNO MARK
--------------------------
01 89
02 78
03 67
04 56
RESULT:
Thus the above program has been executed successfully.
6.2. DATEFUNCTION
(i) Dept_ID
(ii) Dept_NAME
3. Create the table employee with below find between field names.
(i) Employee_ID
5. Display the result from the table employee and department using the joins link Left Join, Right Join &
Full Join.
CODING
SQL> create table student (sno number (3), name varchar (10), department varchar (10));
Table Created.
SQL> insert into student values (&sno, ‘&name’, ‘&department’);
Enter value for sno: 1
Enter value for name: Prakash
Enter value for department: bca
Old 1: insert into student values (&sno, ‘&name’, ‘&department’)
New 1: insert into student values (1, ‘Prakash’, ‘bca’)
1 row created.
SQL> insert into student values (&sno, ‘&name’, ‘&department’);
Enter value for sno: 2
Enter value for name: Belin
Enter value for department: bba
Old 1: insert into student values (&sno, ‘&name’, ‘&department’)
New 1: insert into student values (2, ‘Belin’, ‘bba’)
1 row created.
SQL> insert into student values (&sno, ‘&name’, ‘&department’);
Enter value for sno: 3
Enter value for name: Ravi
Enter valuve for department: maths
Old 1: insert into student values (&sno, ‘&name’,‘&department’)
New 1: insert into student values (3, ‘ravi’, ‘maths’)
1 row created.
SQL> select * from student;
SNO NAME DEPARTMENT
……………………………………………….
1 Prakash bca
2 Belin bba
3 Ravi maths
TABLE-2
SQL> create table fees (bill_id number (5), sno number (5), particular varchar (20));
Table Created.
SQL> insert into fees values (&bills_id, &sno, ‘&particular’);
Enter value for bill_id: 1
Enter value for sno: 2
Enter value for particular: semester
Old 1: insert into fees values (&bill_id, &sno,‘&particular’)
New 1: insert into fees values (1, 2, ‘semester’)
1 row created.
SQL> insert into fees values (&bills_id, &sno, ‘&particular’);
Enter value for bill_id: 2
Enter value for sno: 5
Enter value for particular: record
Old 1: insert into fees values (&bill_id, &sno, ‘&particular’)
New 1: insert into fees values (2, 5, ‘record’)
1 row created.
SQL> insert into fees values (&bills_id, &sno, ‘&particular’);
Enter value for bill_id: 3
Enter value for sno: 10
Enter value for particular: function
Old 1: insert into fees values (&bill_id, &sno, ‘&particular’)
New 1: insert into fees values (3, 10, ‘function’)
1 row created.
OUTPUT: