0% found this document useful (0 votes)
7 views

Mysql Server

Uploaded by

chintu chintu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Mysql Server

Uploaded by

chintu chintu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

use sql2;

--parent table
create table dept(deptno int,dname varchar(20), loc varchar(20),constraint
pk_dept primary key(deptno));

select * from dept;

--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');

select * from employee;--for seeing the data entered in table

INSERT INTO employee VALUES (7839, 'KING', 'PRESIDENT', NULL,CAST('1981-11-17' AS


DATE),5000, NULL, 10),
(7698, 'BLAKE', 'MANAGER', 7839, CAST('1981-05-01' AS DATE), 2850, NULL, 30),
(7782, 'CLARK', 'MANAGER', 7839, CAST('1981-06-09' AS DATE), 2450, NULL, 10),
(7566, 'JONES', 'MANAGER', 7839, CAST('1981-04-02' AS DATE), 2975, NULL, 20),
(7788, 'SCOTT', 'ANALYST', 7566, DATEADD(DAY, -85, CAST('1987-07-13' AS
DATE)),3000, NULL, 20),
(7902, 'FORD', 'ANALYST', 7566, CAST('1981-12-03' AS DATE), 3000, NULL, 20),
(7369, 'SMITH', 'CLERK', 7902, CAST('1980-12-17' AS DATE), 800, NULL, 20),
(7499, 'ALLEN', 'SALESMAN', 7698, CAST('1981-02-20' AS DATE), 1600, 300, 30),
(7521, 'WARD', 'SALESMAN', 7698, CAST('1981-02-22' AS DATE), 1250, 500, 30),
(7654, 'MARTIN', 'SALESMAN', 7698, CAST('1981-09-28' AS DATE), 1250, 1400, 30),
(7934, 'MILLER', 'CLERK', 7782, CAST('1982-01-23' AS DATE), 1300, NULL, 10),
(7900, 'JAMES', 'CLERK', 7698, CAST('1981-12-03' AS DATE), 950, NULL, 30),
(7876, 'ADAMS', 'CLERK', 7788, DATEADD(DAY, -51, CAST('1987-07-13' AS DATE)),
1100, NULL, 20),
(7844, 'TURNER', 'SALESMAN', 7698, CAST('1981-09-08' AS DATE), 1500, 0, 30);

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 who joined the date after 1981

w a q t d employees informatipn whoes commision more than 1000?

w a q t d e i who are working in deptno 30 amnd salary more than 1500,

w a q t d e i who are workking as a clerck indeptn no 20

w a q t d e i who are working in deptno 10,30?

w a q t d e i who are working as manager ,analyst

w a q t d e i whos salary in between 1000& 2000 and incluce same salaried also

w a q t d e i who are who are joined in the year of 1982

who joined the date after 1981

range operators:

these operators which selects data according to particular range 2 types of range operators are there

1) between 2) not between

not between :

to display the ddata ootside the rane of the previous exapmle use not between .

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy