0% found this document useful (0 votes)
43 views7 pages

21BCS10039 - Faiz - Dbms Worksheet MST 1

The document contains the code for a database management system (DBMS) assignment. It includes: 1) Creating a teacher table with attributes and inserting 10 records 2) Queries to display names containing "s", average salary, records in September 3) Altering the table to add a city column 4) A PL/SQL block to output the student's name and ID

Uploaded by

LYRICS BOOK
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)
43 views7 pages

21BCS10039 - Faiz - Dbms Worksheet MST 1

The document contains the code for a database management system (DBMS) assignment. It includes: 1) Creating a teacher table with attributes and inserting 10 records 2) Queries to display names containing "s", average salary, records in September 3) Altering the table to add a city column 4) A PL/SQL block to output the student's name and ID

Uploaded by

LYRICS BOOK
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/ 7

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

MST DBMS 1

Student Name: Mohd Faiz UID: 21BCS10039


Branch: CSE Section/Group: 705 A
Semester: 3RD
Subject Name: Database Management System Subject Code: 21CSH214

1.Aim: Create a  table for teacher data containing attributes


TEACHER_CODE,TEACHER_NAME, DOJ,deptt,salary and do the following
a)      Add 10 unique records to the table
b)      Display teacher_name which contains alphabet “s” at any position
c)       Find average and sum of salaries
d)      Select records where DOJ is in September month
e)      Add a new column named CITY_RES to the table
f)       Create a PL/SQL block to display your name and UID at the output.
Note: The output screenshots need to be added after each step.

Program code:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

create table teacher(teacher_code integer,teacher_name varchar(20),DOJ


varchar(20),deptt varchar(20),salary integer);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(01,'mohd'
,'january','physics',12345);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(02,'faiz','f
ebruary','chemistry',15464);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(03,'kaif','
march','bio',789456);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(04,'zaid','
april','maths',47895);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(05,'saif','
may','ip',10000);
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(06,'sara','j
une','cse',485123);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(07,'saima'
,'july','dsa',85213);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(08,'sania',
'august','sql',785236);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(09,'simra'
,'september','aptitude',548981);

insert into
teacher(teacher_code,teacher_name ,DOJ ,deptt ,salary)values(10,'sidra','
december','physics',748596);

select* from teacher;

select * from teacher where teacher_name like 's%';

select avg(salary) as average_salary from teacher;

select sum(salary) as total_salary from teacher;


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

select * from teacher where DOJ='september';

alter table teacher add(city_res varchar(20));

DECLARE

var varchar2(40) := 'Mohd Faiz 21BCS10039' ;

-- it was fun to code this for mst

BEGIN

dbms_output.put_line(var);

END;

Output:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

You might also like