Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon, which comes first ob_start or session, wwwxxx/58/2010, xxxxdup, xxxxdup, mailx informatii, should producers of software-based services, such as atms, be held liable for economic injuries suffered when their systems fail?

Links

XODOX
Impressum

#1: INTERSECT, MINUS

Posted on 2011-10-16 13:42:36 by legrega

WHat is wring with the following three sentences?

SELECT p.name, p.gender, e.pizza FROM Person p, Eats e WHERE p.name =3D
e.name AND p.gender =3D 'female' AND (e.pizza =3D 'mushroom')
INTERSECT
SELECT p.name, p.gender, e.pizza FROM Person p, Eats e WHERE p.name =3D
e.name AND p.gender =3D 'female' AND (e.pizza =3D 'pepperoni');


SELECT * FROM Person MINUS SELECT * FROM Person WHERE name=3D'Amy';


mysql> SELECT name FROM Person MINUS SELECT name FROM Person WHERE Person.a=
ge <
18;

I've tried my first time sets and am not sure where is the problem,
I've tried to google but when translating to my db it just doesn't
work,
You can download the create db sql here:
http://s3.amazonaws.com/dbclass-resources/docs/pizza.sql

âÂ¥âÂ¥âÂ=A5 When the sun rises I receive and when it sets I=
forgive! âÂ¥âÂ¥âÂ=A5
ÃÂâÂ=A5 -> http://moj.skavt.net/gleskovs/ <- âÂ=A5 Always, Greg=
a Leskováek

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Report this message

#2: Re: INTERSECT, MINUS

Posted on 2011-10-16 14:06:09 by sureshkumarilu

--20cf30363b7dd7e22d04af695064
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,

EXISTS function provides a simple way to find intersection between tables
(INTERSECT operator from relational model).

If we have table1 and table2, both having id and value columns, the
intersection could be calculated like this:

SELECT * FROM table1 WHERE EXISTS(SELECT * FROM table2 WHERE table1.id=3D
table2.id AND table1.value=3Dtable2.value)

For more details on intersect and minus, check this blog -
http://www.bitbybit.dk/carsten/blog/?p=3D71

Thanks
Suresh Kuna

On Sun, Oct 16, 2011 at 5:12 PM, Grega Leskováek <legrega@gmail.com> w=
rote:

> WHat is wring with the following three sentences?
>
> SELECT p.name, p.gender, e.pizza FROM Person p, Eats e WHERE p.name =3D
> e.name AND p.gender =3D 'female' AND (e.pizza =3D 'mushroom')
> INTERSECT
> SELECT p.name, p.gender, e.pizza FROM Person p, Eats e WHERE p.name =3D
> e.name AND p.gender =3D 'female' AND (e.pizza =3D 'pepperoni');
>
>
> SELECT * FROM Person MINUS SELECT * FROM Person WHERE name=3D'Amy';
>
>
> mysql> SELECT name FROM Person MINUS SELECT name FROM Person WHERE
> Person.age <
> 18;
>
> I've tried my first time sets and am not sure where is the problem,
> I've tried to google but when translating to my db it just doesn't
> work,
> You can download the create db sql here:
> http://s3.amazonaws.com/dbclass-resources/docs/pizza.sql
>
> âÂ¥âÂ¥âÂ=A5 When the sun rises I receive and when it sets=
I forgive! âÂ¥âÂ¥âÂ=A5
> ÃÂâÂ=A5 -> http://moj.skavt.net/gleskovs/ <- âÂ=A5 Always, Gr=
ega Leskováek
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=3Dsureshkumarilu@gmail.co m
>
>


--=20
Thanks
Suresh Kuna
MySQL DBA

--20cf30363b7dd7e22d04af695064--

Report this message