+ 6

Can anyone please help me out to write following sql queries ??

Tables : table dep-dnum int not null,dname varchar,loc varchar,primary key(dnum) table emp-eno int not null,ename varchar,salary int,hiredate date,dnum int,primary key(eno),foreign key(dnum) references dep(dnum) table pro-pno int not null,pname varchar,dnum int,primary key(pno),foreign key(dnum) references emp(dnum) table wrks-eno int,pno int,hours int,foreign key(eno) references emp(eno),foreign key(pno) references pro(pno) 1To find emp who wrks on every project 2 To find emp who wrks on any project

25th Sep 2017, 3:57 PM
sadiya zainab
sadiya zainab - avatar
4 Answers
+ 3
No thanks I only find out @rahmat Queries(MYSQL) 1 To find employee names who works on every project select ename from employee e,project p where e.dnum=p.dnum and pno=all(select pno from works_on); ename=employee name dnum=department number pno=project number e,p=aliases joining condition=(e.dnum=p.dnum) employee,project,works_on are tables 2 To find employee name who does not work on any project select ename from employee e,project p where e.dnum=p.dnum and pno in(select pno from works_on w where p.pno<>w.pno); ename=employee name dnum=department number pno=project number e,p,w=aliases joining condition=(e.dnum=p.dnum) employee,project,works_on are tables
28th Sep 2017, 3:03 PM
sadiya zainab
sadiya zainab - avatar
+ 4
They are 4 tables department,employees,project and works_on ,try to write queries for employee who can work on every project dnum=department number eno=employee number pno=project number I didn't wrote that sql script & for creating table they hve use due to less space I removed keywords create & varchar (10)(size) & semicolons @luka
26th Sep 2017, 9:12 AM
sadiya zainab
sadiya zainab - avatar
0
i can answer this your problem face to face to you
28th Sep 2017, 7:32 AM
rahmat jafari
rahmat jafari - avatar