0% found this document useful (0 votes)
2 views4 pages

Practical 10 dbms

The document outlines the creation and modification of two tables, 'emp' and 'dept', including the insertion of multiple records into each. It also describes the creation of views 'emp_view' and 'dept_view', along with various SQL operations performed on these views, such as updates and deletions. Additionally, it includes outputs for each SQL command executed, demonstrating the results of these operations.

Uploaded by

jsamiksha051
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Practical 10 dbms

The document outlines the creation and modification of two tables, 'emp' and 'dept', including the insertion of multiple records into each. It also describes the creation of views 'emp_view' and 'dept_view', along with various SQL operations performed on these views, such as updates and deletions. Additionally, it includes outputs for each SQL command executed, demonstrating the results of these operations.

Uploaded by

jsamiksha051
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical 10 : Create and modify view

create table emp(emp_name varchar(20),emp_no


number(10),salary number(7));
output: table created

insert into emp


values('samiksha',1001,80000,123456789);
output:1 row(s)inserted

insert into emp


values('ashish',1002,90000,7878445414);
output:1 row(s)inserted

insert into emp values('seema',1003,50000,874541515);


output:1 row(s)inserted

insert into emp


values('ramesh',1004,44000,9875464784);
output:1 row(s)inserted

insert into emp values('saee',1005,10000,549468545);


output:1 row(s)inserted

insert into emp values('shree',1006,15000,648465555);


output:1 row(s)inserted

department table

create table dept(deptno number(10),empno


number(10),deptname varchar(10),location
varchar(10),jobtype varchar(10));
output: table created

insert into dept values(100 ,1001 ,'computer'


,'katraj' ,'lecturer');
output:1 row(s)inserted
insert into dept values(101,1002 ,'civil' ,'katraj'
,'hod');
output:1 row(s)inserted

insert into dept values(100 ,1003 ,'computer'


,'katraj' ,'hod');
output:1 row(s)inserted

insert into dept values(102 ,1004 ,'electrical'


,'katraj' ,'lecturer');
output:1 row(s)inserted

insert into dept values(101 ,1005,'civil' ,'katraj'


,'lecturer');
output:1 row(s)inserted

insert into dept values(100,1006,'electrical'


,'katraj' ,'lecturer');
output:1 row(s)inserted

practical related questions:


Q1)write the output of the following:

Ans: create view emp_view as select


emp_no,emp_name,salary from emp;
Output: View created.

Q2)write the output of the following:

Ans:update emp_view set emp_name='ramesh' where


emp_no=1001;
Output: 1 row(s) updated.

Q3) write the output of the following:


Ans: delete from emp_view where emp_no=1005;

Output: 1 row(s) deleted.


Q4) write the output of the following:
Ans: delete view emp_view;
Output: invalid table name

Exercise

Q1)create dept_view on dept table.


Ans : create view dept_view as select
empno,deptno,deptname from dept;

Output: View created.

Q2)insert new record in dept_view view.

Ans: insert into dept_view


values(1001,100,'computer','katraj');
Output:1 row(s) inserted.

insert into dept_view


values(1002,200,'civil','katraj');
Output:1 row(s) inserted.

insert into dept_view


values(1003,100,'computer','katraj');
Output:1 row(s) inserted.

Q3)modify location of deptno 100 of dept_view.

Ans: update dept_view set location='deccan' where


deptno=100;

Output: 4 row(s) updated.


As the table of dept already contained deptno as 100
so it shows 4 rows that are updated.

Q4)delete the record of deptno 200 from dept_view.


Ans: delete from dept_view1 where deptno=200;

Output: 1 row(s) deleted.

Q5)delete the view dept_view.


Ans: drop view dept_view1;
Output: View dropped.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy