DBMS Lab Mannual
DBMS Lab Mannual
Query2: Enter five tuples into the existing table and display.
Command 2:
insert into Employee values(1001,’Ramesh’,25000);
insert into Employee values(1002,’Tagore’,20000);
insert into Employee values(1003,’Bharath’,10000);
insert into Employee values(1004,’Prakesh’,5000);
insert into Employee values(1005,’Shreedhar’100000);
Query 8: Execute count(*) to get number of rows in all the columns and
display.
Command 8: select count(*) from Employee;
Query2: Add a new attribute Avg with datatype as number with size (5,2) to
the existing table.
Command2: alter table student add (Avg number(5,2));
Desc student;
Query2: Enter five tuples into the existing table and display it.
Command 2:
insert into Professor values(501,’Amarnath’,’Zoology’,9851236880);
insert into Professor values(502,’Srinivas’,’Botony’,9834205651);
insert into Professor values(503,’Ram’,’Chemistry’,8996565430);
insert into Professor values(504,’Rehman’,’Botony’,9943210381);
insert into Professor values(505,’John’,’Psychology’,9833209811);
select*from Professor;
Query5: update the Profid of any one Professor and display the existing table.
Command 5: update Professor set Profid =509 where Profid=505;
Answer:
Query 1: Create table of the Cities with following attributes:(ID number (1),
name varchar (20), city varchar (10), contact number (10));
Command 1: Create table Cities (ID number (1), name varchar (20),
city varchar (10), contact number (10));
Query 3: Update any one of attribute from the table and display it
Command 3: update Cities set city=’Delhi’ where ID=1;
Select*from Cities;
Query 2: Enter five tuples into the existing table and display it
Command 2:
Insert into Employee values(1, ‘Robo’,25000);
Insert into Employee values(2, ‘Chiti’, 10000);
Insert into Employee values(3, ‘Sana’,75000);
Insert into Employee values(4, ‘Vasi’, 20000);
Insert into Employee values(5, ‘Rishi’,30000);
Select*from Employee;
Query 3: Implement nested query and display the name who has got the
Highest salary
Command 3: EName from Employee where Empsal= (select max (EmpSal)
from Employee);
Answer:
Query 1: Create the table Student with the following attributes:
(Rno number (3), Sname varchar (15), Courseid number (5));
Command1: Create table Student (Rno number (3), Sname varchar (15),
Courseid number (5));
Desc Student;
Query 3: Enter Three tuples into Student table and display it.
Command 3: Insert into Student values(701,’Preethi’,4001);
Insert into Student values(702,’Chaithra’,4002);
Insert into Student values(703,’Nithya’,4003);
Query 4: Enter Three tuples into Course table and display it.
Command 4: Insert into Course values(4001,’C lang’);
Insert into Course values(4003,’Java’);
Insert into Course values(4004,’Python’);
Select *from Course;
Query 5: Execute Inner join or Equi join Operation and display it.
Command 5: Select Sname,Cname from Student inner join Course on
Student.Courseid=Course.Courseid;
Query 10: Execute Cartesian Product Join Operation and display it.
Command 10: Select Sname,Cname from Student,Course;
Answer:
Query 1: Create the table student with the following attributes:
(stdRno number(1),stdName varchar(10),Total number(3));
Command 1: Create table student (stdrno number (1), stdName varchar (10),
total number(3));
Desc student;
Query 2: Enter five tuples into the existing table and display.
Command: insert into student values(1,'preethi',700);
insert into student values(2,'chaithra',900);
insert into student values(3,'nithya',850);
insert into student values(4,'sneha',700);
insert into student values(5,'chitti',680);
• select*from student;
student values(5,‘Dimple’,‘MCA’);