mysqlÖÐcountº¯Êý×¢ÒâÊÂÏî
񡜧
CREATE TABLE `user` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(10) DEFAULT NULL,
`password` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
ÆäÖÐÓÐÊý¾ÝΪ£º
1 name1 123456
2 name2 123456
3 name3 123456
4 name4 NULL
ÒÔÏÂÈý¸ö²éѯ·µ»Ø¼¸ÄØ£¿
£¨1£©select count(*) from `user`
£¨2£©select count(name) from `user`
£¨3£©select count(password) from `user`
´ð°¸ÊÇ£º4,4,3
ÒòΪ£º
£¨1£©count(*)ÊǶÔÐÐÊýÄ¿½øÐмÆÊý£¬ËùÒÔµ±È»ÊÇ4
£¨2£©count(column_name)ÊǶÔÁÐÖв»Îª¿ÕµÄÐнøÐмÆÊý£¬ËùÒÔcount(name)=4£¬¶øcount(password)=3
Ïà¹ØÎĵµ£º
====================================================
Òý×Ô£ºhttp://blog.sina.com.cn/s/blog_538a9d1901008f9g.html
ʲôÊÇC2¼¶°²È«ÐÔ£¿°²È«ÐԵķÖÀàÊÇÔõÑùµÄ£¿(2008-01-30 17:04:39)
DÀࣺ×îµÍ±£»¤£¬±£Áô¸ø²»ÄÜͨ¹ý¸ü¸ß¼¶±ð¼ì²éµÄϵͳ
C1£º½÷É÷±£»¤£¬ÒªÇóÓлùÓÚÓû§¼¶±ðµÄ¿ØÖÆÀ´±£»¤Êý¾Ý£¬Ö÷Òª·ÀÖ ......
·µ»ØÀ´×ÔÓÚ²ÎÊýÁ¬½áµÄ×Ö·û´®¡£Èç¹ûÈκβÎÊýÊÇNULL£¬·µ»ØNULL¡£¿ÉÒÔÓг¬¹ý2¸öµÄ²ÎÊý¡£Ò»¸öÊý×Ö²ÎÊý±»±ä»»ÎªµÈ¼ÛµÄ×Ö·û´®ÐÎʽ¡£
mysql> select CONCAT('My', 'S', 'QL');
-> 'MySQL'
mysql> select CONCAT('My', NULL, 'QL');
-> NULL
mysql> select CONCAT(14.3);
-> '14.3'
È磺update test set ......
public class select {
public List XiuGai_select(String keyword){
List list=new ArrayList();
Connection conn = null;
Statement stmt = null;
String sql=null;
ResultSet res = null;
get ......
°²×°µÄOSΪSolaris10,mysql °æ±¾ÊÇ5.1.38
Ò»¡¢Ê¹ÓÃRPM°ü½øÐа²×°
Ê×ÏÈ¿ÉÒÔ´Ó°²×°¹âÅÌÖлòÕßµ½mysqlµÄÍøÕ¾ÉÏÏÂÔØ¶ÔÓ¦°æ±¾µÄrpm°üÈçÏ£º
MySQL-server-community-5.1.38-0.rhel5.i386.rpm
MySQL-client-community-5.1.38-0.rhel5.i386.rpm
½Ó×ÅÎÒÃÇ¿ÉÒÔʹÓÃrpmÃü ......
Mysql ´æ´¢Àý³ÌµÄʹÓÃ
Ò»¡¢ ¼ò½é
´æ´¢¹ý³Ì£¨Stored Procedure£©ÊÇÒ»×éΪÁËÍê³ÉÌØ¶¨¹¦ÄܵÄSQLÓï¾ä¼¯£¬¾±àÒëºó´æ´¢ÔÚÊý¾Ý¿âÖС£Óû§Í¨¹ýÖ¸¶¨´æ´¢¹ý³ÌµÄÃû×Ö²¢¸ø³ö²ÎÊý£¨Èç¹û¸Ã´æ´¢¹ý³Ì´øÓвÎÊý£©À´Ö´ÐÐËü¡£´æ´¢¹ý³Ì ÊÇÊý¾Ý¿âÖеÄÒ»¸öÖØÒª¶ÔÏó£¬ÈκÎÒ»¸öÉè¼ÆÁ¼ºÃµÄ ......