SELECT DISTINCT pub_name FROM publishers WHERE EXISTS
(SELECT * FROM titles WHERE pub_id = publishers.pub_id AND type ='business');
SELECT pub_name FROM publishers WHERE NOT EXISTS
(SELECT * FROM titles WHERE pub_id = publishers.pub_id AND type ='business');
Oracle 中通过sql trace来分析NOT IN/MINUS/NOT EXISTS的比较 http://space.itpub.net/24862808/viewspace-708947
连接join(LEFT JOIN/RIGHT JOIN/内连接/全连接/自连接/交叉连接)
基本知识参考http://www.cnblogs.com/eflylab/archive/2007/06/25/794278.html
Tip:用连接来代替子查询
tab1 LEFT JOIN tabl2 ON tab1.yy = tab2.zz WHERE
LETT JOIN以其左边的表为基准,RIGHT JOIN以其右边表为基准。
/opt/mysql/server-5.5/bin/mysqld: error while loading shared libraries: libaio.so.1:
cannot open shared object file: No such file or directory
原因是未安装libaio,执行安装
$ sudo apt-get install libaio-dev
$ find /lib -name "*libaio*"
/lib/libaio.so.1
/lib/libaio.so.1.0.1
再次执行下面命令,安装成功,并显示一些有用的信息:
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql/server-5.5/bin/mysqladmin -u root password 'new-password'
/opt/mysql/server-5.5/bin/mysqladmin -u root -h guxu-Lenovo-B460 password 'new-password'
Alternatively you can run:
/opt/mysql/server-5.5/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /opt/mysql/server-5.5 ; /opt/mysql/server-5.5/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql/server-5.5/mysql-test ; perl mysql-test-run.pl