Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQL count(*) Óë count(col) ²éѯЧÂʱȽÏ

MySQL count(*) Óë count(col) ²éѯЧÂʱȽÏ
ÓÅ»¯×ܽ᣺
1.ÈκÎÇé¿öÏÂSELECT COUNT(*) from xxx ÊÇ×îÓÅÑ¡Ôñ£»
2.¾¡Á¿¼õÉÙSELECT
COUNT(*) from xxx WHERE COL = ‘xxx’ ÕâÖÖ²éѯ£»
3.¶Å¾øSELECT COUNT(COL) from tablename WHERE COL = ‘xxx’
µÄ³öÏÖ¡£(ÆäÖÐCOL·ÇÖ÷¼ü)
»·¾³£º
MySQL°æ±¾£º5.0.45
OS£ºWindows XP SP3
Êý
¾Ý±íÒ»£ºsphinx
+———-+——————+——+—–+———+—————-+
| Field    |
Type             | Null | Key | Default | Extra          |
+———-+——————+——+—–+———+—————-+
|
id       | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
|
til      | varchar(100)     | NO   |     |         |                |
|
content  | text             | NO   |     |         |                |
|
dataline | int(11)          | NO   |     |         |                |
+———-+——————+——+—–+———+—————-+
¼Ç
¼Êý£º1120100
²éѯһ£º
mysql>


Ïà¹ØÎĵµ£º

¡¾Õª×ÔCSDNÂÛ̳¡¿mysqlÃüÁîÐг£ÓÃÃüÁî

mysqlÃüÁîÐг£ÓÃÃüÁî
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ ......

ÕÒ»Ømysql µÄroot ÃÜÂë

£¨1£©ÒÔubuntuµÄrootÓû§µÇ½
£¨2£©Í£Ö¹MYSQL·þÎñÆ÷£º
        /etc/init.d/mysql stop
£¨3£©Ìø¹ýÊÚȨ±íÖ´ÐÐMYSQL·þÎñÆ÷£º
       mysqld_safe --skip-grant-tables --skip-networking &
 (×¢£º²ÎÊý--skip-grant-tablesΪÌø¹ýÊÚȨ±í£»--sk ......

MySql ´æ´¢¹ý³ÌÓαêʹÓÃʾÀý

DROP PROCEDURE IF exists pro_removeBillRemindByUserId;
create procedure pro_removeBillRemindByUserId(userId int)
begin
    declare ts varchar(500);
    declare cnt int default 0;
    declare f_ID,b  int;
    DECLARE cur_1 CURSOR ......

mysql ɾ³ý±íÖеÄÖظ´¼Ç¼£¬Ö»±£ÁôÆäÖÐÒ»Ìõ

²éѯÖظ´¼Ç¼ select * from table GROUP BY name 
Ö»°ÑÓÐÖظ´µÄÏÔʾ³öÀ´
select * ,count(*) as nums from tab_a group by name having nums>1
·½·¨Ò»£º£¨Õâ¸ö·½·¨±È½Ï²»´í£¬Ö»ÊÇ×ÔÔö×ֶλáÖؽ¨£©
  н¨Ò»¸öÁÙʱ±í  
  create   table   tmp   as   select   * &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ