1.在count 不重復的記錄的時候能用到,比如SELECT COUNT( DISTINCT id ) FROM tablename;就是計算talbebname表中id不同的記錄有多少條。 2,在需要返回記錄不同的id的具體值的時候可以用,比如SELECT DISTINCT id FROM tablename;返回talbebname表中不同的id的具體的值。 3.上面的情況2對于需要返回mysql表中2列...
show index from talbe_name [from db_name]; show status; show variables; show [full] processlist; show table status [from db_name]; show grants for user; 除了status,processlist和grants外,其它的都可以帶有l(wèi)ike wild選項,它可以使用SQL的'%'和'_'字符; ...
表結(jié)構(gòu)如上所示,要查詢C列為空的記錄的SQL語句不是select * from table where c=null; 或者 select * from table where c=''; 而應當是 select * from table where c is null; 相反地要查詢不為空的則應當是 select * from talbe where c<>''; 或者 select * from table where c is not null; ...