Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

-- all columns and all rows

select * from testing_11;


-- selected column and all rows
select rollno from testing_11;

--===================
select * from testing_11;

select * from testing_11 where fees is null;

--
select * from player;

select * from player where gender is null;

select * from player where gender is not null;

-- Between AND example

select * from player where matchfee between 70000 and 95000;

select * from player where matchfee >70000;

select * from player where matchfee<70000;

select * from player where matchfee<=70000;

select * from player where matchfee>=70000;

select * from player where matchfee=70000;

-- String operator Like (%,_)

select * from player where P_name like 'S%';


-- record fetched which end with 'r'
select * from player where P_NAME like '%r';

select * from player where p_name like '%h%';

select P_name from player where p_name like '_____';

select P_name from player where p_name like 'U____';

select P_name from player where p_name like '____i';

select P_name from player where p_name not like '____i';

--
select table_name from tabs where table_name like 'S%';

-- create a table

create table player_det


(
pid number(4) constraint pk_player_p_id primary key,
pname varchar(30) constraint nn_pname not null,
ptype varchar(15) constraint chk_ptype check(ptype in('Bowler','Batsman','All
rounder','Wicketkeeper','Coach','Physio')),
dob date,
gender char(1) constraint chk_gender_p_det check(gender in ('M','F'))
);

insert into player_det


values(1001,'Bhuneshwar','Bowler','05-Aug-1990','M');

insert into player_det


values(1002,'Sanjay Manjrekar','Coach','05-Aug-1980','M');

insert into player_det


values(1003,'Ravi Shastri','Coach','05-Aug-1970','M');

commit;

select * from player_det;

insert into player_det


values(1004,'Rohit Sharma','Batsman','05-Aug-1990','M');

insert into player_det


values(1005,'Shami','Bowler','05-Aug-1995','M');

insert into player_det


values(1006,'Reshav Pant','Wicketkeeper','05-Aug-1996','M');

insert into player_det


values(1007,'Mithali Raj','Batsman','05-Aug-1996','F');

insert into player_det


values(1008,'Kaur','All rounder','05-Aug-1996','F');

commit;

select * from player_det;

select * from player_Det where ptype in ('Bowler','Batsman');

select * from player_Det where ptype not in ('Bowler','Batsman');

You might also like