0% found this document useful (0 votes)
8 views3 pages

RDBMS Program 3

nil
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)
8 views3 pages

RDBMS Program 3

nil
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
You are on page 1/ 3

EX.

NO : 3

DATE :

AIM :

To create a table student_master with the following fields name, reg_no, dept and year
with suitable datatype use select command to do the following

a. Select the Students name column


b. Eliminate the duplicate entry in table
c. Sort the table inalphabetical order
d. Select all the students of a particular department

PROGRAM :

// CREATE TABLE

CREATE TABLE student_master(NAME VARCHAR2(20),REG_NO NUMBER(5),DEPT


VARCHAR2(20), year date );

//INSERT DATA

insert into student_master values('Anand',16,'Computer',date'2020-11-16');

insert into student_master values('Sahayam',27,'Computer',date'2021-03-27');

insert into student_master values('Siva',11,'Chemistry',date'2019-11-11');

insert into student_master values('Kani',11,'Biology',date'2010-10-16');

insert into student_master values('Muthu',06,'Biology',date'2010-06-04');

insert into student_master values('Mani',22,'Physics',date'2010-03-22');

insert into student_master values('Santhanam',19,'Computer',date'2021-10-19');

insert into student_master values('Mahes',07,'Computer',date'2020-04-07');

insert into student_master values('Sahayam',27,'Computer',date'2021-03-27');

insert into student_master values('Santhanam',19,'Computer',date'2021-10-19');

insert into student_master values('Mahes',07,'Computer',date'2020-04-07');

//SELECT THE STUDENTS NAME COLUMN

select name from student_master;

//ELIMINATE THE DUPLICATE ENTRY IN TABLE


select NAME, REG_NO, DEPT, year, count(*) as cnt from student_master group by
NAME,REG_NO,DEPT,year having count(*) > 1;

//SORT THE TABLE IN AlPHABETICAl ORDER

SELECT * FROM student_master

ORDER BY name ASC;

//SELECT ALL THE STUDENTS OF A PARTICULAR DEPARTMENT

select * from student_master where dept='Computer';

OUTPUT:

STUDENT_MASTER TABLE:

STUDENTS NAME:

DUPLICATE ENTRY:
SORT IN ALPHABETICAL ORDER:

STUDENTS IN PARTICULAR DEPARTMENT:

RESULT:

Thus the Querys are run successfully.

You might also like