Mysql Server
Mysql Server
--parent table
create table dept(deptno int,dname varchar(20), loc varchar(20),constraint
pk_dept primary key(deptno));
--child table--
create table employee(empno int,ename varchar(20),job varchar(20),
mrg int,hiredate date,sal money,comm money,deptno int,
constraint pk_emp primary key(empno),
constraint fk_deptno foreign key(deptno)
references dept(deptno) );
sp_help employee --command for seeing the table
insert into dept values(10,'accounting','new york'),
(20,'research','delhi'),
(30,'sales','chicago'),
(40,'operation','botson');
r operator
if u want to select roes thsts specify that satisfy atlest one of the given
condition you can use the logical operator,or
if you Wnt tit finf the names of th student who are studying iether
w A Q TO DISPLAY All the employess information details who are working in depno
10,20?
and :
if you want to elect rows thst must satisfy ALL THE GIVEN CONDITIONS YOU CAN
USE THE LOGICAL OPERATOR AND ,
TO WHERE AGE>=10 AND AGE<=15;
NOT:
IF YOU WANT TO FIND ROWS THSTA DONNOT SATISFY A CONDITION you can use the
logical operator,nnt,
where not games=’’football’
w a q to display all the employees information details who are belongs to
departno 20,and having salary grater thsn 2000?
w a q to display all the employees information
w a q to display all the employees information except department no 20
Comparisun operator:
comparison operator are used to compare the column data withe specific values in a condition and so
used along with the selected statement s to filter data based on specific conditionswho
w a q t d e i whos salary in between 1000& 2000 and incluce same salaried also
range operators:
these operators which selects data according to particular range 2 types of range operators are there
not between :
to display the ddata ootside the rane of the previous exapmle use not between .