Lab Assignment-1 1. Create Table Student (Rno, Name, DOB, Gender, Class, College, City, Marks)
Lab Assignment-1 1. Create Table Student (Rno, Name, DOB, Gender, Class, College, City, Marks)
1. Create table Student (Rno, Name, DOB, Gender, Class, College, City,
Marks).
create table Student2(Rno number(5), Name varchar(10), DOB varchar(12), Gender
varchar(10), Class varchar(10), College varchar(10), City varchar(10), Marks
number(10));
2. Insert 5 records in student table
insert into Student2 values(1, 'Swati', '03/12/1995', 'FEMALE', 'ENC', 'Thapar',
'Patiala', 91);
insert into Student2 values(2, 'Kartik', '19/09/1996', 'MALE', 'ENC', 'Thapar',
'Kanpur', 92);
insert into Student2 values(3, 'Tamanna', '28/03/1997', 'FEMALE', 'ENC', 'Thapar',
'Amritsar', 93);
insert into Student2 values(9, 'Shubham', '11/10/1997', 'MALE', 'ENC', 'Thapar',
'Jodhpur', 94);
insert into Student2 values(10, 'Saif', '21/06/1997', 'MALE', 'ENC', 'Thapar',
'Patiala', 95);
3. Display the information of all the students
select * from Student2;
4. Display the detail structure of student table
desc Student2;
4. Display the employee names of those clerks whose salary > 2000
select distinct ename,job,salary from empsa where job='Clerk' and salary>2000;
6. Display all details of employees whose salary between 2000 and 3000
select distinct * from empsa where salary between 2000 and 3000;
7. Display all details of employees whose dept no is 10, 20, or 30
select distinct * from empsa where deptno in(10,20,30);
9. Display dept no & salary in ascending order of dept no and with in each dept no
salary should be in descending order
select distinct deptno,salary from empsa order by deptno asc,salary desc;
10. Display name of employees that starts with ‘C’
select distinct ename from empsa where ename like 'C%';
12. Display name of employees having two ‘a’ or ‘A’ chars in the name
select distinct ename from empsa where ename like '%a%a%' or ename like '%A%A%';
13. Display the name of the employees whose second char is ‘b’ or ‘B’
select distinct ename from empsa where ename like '_B%' or ename like '_b%';
14. Display the name of the employees whose first or last char is ‘a’ or ‘A’