P 1
P 1
DD'),'s05','p','y',TO_DATE('2016-05-26','YYYY-MM-DD'),'in process');
insert into sales_order_details values('o46865','p07868',3,3150);
select * from client where name like 'b%'; all letters after b give
table with name starting with b
select * from client where name like 'b_'; one latter after b give
table with name=b+ one word
select * from client where name in 'harsh'; give table
with name=harsh
select * from client where name not in 'harsh'; give table
without name=harsh
select name from client where name not in 'harsh'; only give
name field with not in harsh
select * from client where pincode between 100000 and 999999; give
table with pincode between 100000 to 999999
INTRO PRACTICAL 3
PRACTICAL 3
practical 4
create table clients (id number(6) NOT NULL);
create table client2 (age int check(age >= 8);
create table client4(age number(3) check(age in(5,10,15)));
create table student_data(roll varchar(10) check(substr(roll,3,3) in
('bce','bcm','btm')));
alter table student_data add constraint pk primary
key(roll);------------------------------------ all values in this column should be
unique
create table student1(roll number(10) primary key,name
varchar(6));------------------------------ declare primary key while creating the
table
insert into student1
values(101,'meet');---------------------------------------------------------
alter table student1 add constraint pk1 primary
key(name);--------------------------------------- table can have only primary key
alter table student1 modify name varchar(10) not null;
------------------------------------------ update column with not null attribute
create table student2 (roll number(10), foreign key(roll) references
student1(roll));
------------------------
select table_name from user_tables;
-------------------------------------------------------------- to show all created
table
------------------------
practical 6
1.
select salary from employees where salary>(select salary from employees where
employee_id=100);
select * from employees where salary=(select max(salary) from employees);
select department_id from employees group by department_id having min(salary)>
(select max(salary) from employees where department_id=60);
2.
select * from employees where salary in (select salary from employees where
department_id=90);
select * from employees where salary > any (select salary from employees where
department_id=60);
select * from employees where salary > all (select salary from employees where
department_id=30);
select * from employees where manager_id in (select manager_id from employees where
employee_id in (110,30)) and department_id in (select department_id from employees
where employee_id in (110,30));
select first_name, last_name , department_id from employees;
3.
select * from employees where department_id in (select department_id from employees
group by department_id having max(salary));
select department_id from employees group by department_id;
practical 5