0% found this document useful (0 votes)
10 views5 pages

Lab Exercise For Stud

This document provides SQL commands to: 1. Create an EMP table with columns for employee number, name, designation, salary, and city. 2. Insert 10 records into the EMP table. 3. Perform various queries on the EMP table such as displaying records, adding constraints, deleting records, and creating views and users.

Uploaded by

Rohan
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)
10 views5 pages

Lab Exercise For Stud

This document provides SQL commands to: 1. Create an EMP table with columns for employee number, name, designation, salary, and city. 2. Insert 10 records into the EMP table. 3. Perform various queries on the EMP table such as displaying records, adding constraints, deleting records, and creating views and users.

Uploaded by

Rohan
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/ 5

create table emp(rno number(3),

name varchar(10),
designation varchar(15),
salary number(5),
city varchar(10));

create above table with the given no of records as


under and perform all the queries which are given .
-- insert unique constraint in name
-- insert not null constraint in city
-- insert primary key in rno
-- insert check constraint in salary to input value
more then 5000
-- insert record as under
Rno name designation salary city
1 mann clerk 15000 junagadh
2 jay supervisor 25000 rajkot
3 suresh admin 35000 surat
4 rajesh dba 50000 amreli
5 anil clerk 20000 junagadh
6 kalpesh supervisor 21000 surat
7 mahesh coder 41000 rajkot
8 sunil supervisor 35000 amreli
9 ramesh peon 11000 ahmedabad
10 jayesh clerk 21000 jamnagaar
- - perform following queries

- display table structure


- display table emp records (all)
- display user name
- display all the tables name
- display records only of clerk
- display records of admin or supervisor
- display records of roll no less then 5
- display records where city is not junagadh
- display records where city job is supervisor and city
rajkot
- display all name start with s
- display all the city start with ja
- create savepoint with your choice name
- delete record of rajkot city
- create another savepoint
- delete record of ahmedabad city
- create another savepoint
- delete record of amreli city
- create savepoint
- rollback all the records till first savepoint
- delete all the records from the table
- delete table
- create view of emp table with view1 name with all
the records
- create view of emp table with view2 only of
junagadh city
- insert 1 record of your name through view in the
emp table
- create user gurukul with password student
- grant select on emp to gurukul
- create user student with password gurukul
- grant select,insert,update,delete to student on
emp
- create role star with select and connect permission
- create user newstud with given permission of role
star
- revok all permission from newstud
- delete user student and newstud
- create snapshot of emp table with name welcome
- drop view,snapshot,table,role which are created

You might also like