SQL常用语句
CREATE TABLE `member` ( `uid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `name` char(255) NOT NULL, `pass` char(255) NOT NULL, `token` char(255) NOT NULL, `src_id` int(10) unsigned NOT NULL DEFAULT ‘0‘ COMMENT ‘来源id‘, PRIMARY KEY (`uid`,`name`) ) INSERT INTO Persons (LastName) VALUES (‘Wilson‘) UPDATE Person SET FirstName = ‘Fred‘ WHERE LastName = ‘Wilson‘ DELETE FROM Person WHERE LastName = ‘Wilson‘ SELECT DISTINCT Company FROM Orders SELECT * FROM member LIMIT 5 SELECT * FROM member WHERE NAME LIKE ‘%e_a%‘ SELECT * FROM member WHERE NAME IN (‘zen‘,‘test‘) SELECT * FROM member WHERE uid BETWEEN ‘4‘ AND ‘11‘ SELECT member.`name`,user_data.`nickname` FROM member,user_data WHERE member.`uid`= user_data.`uid` SELECT NAME FROM member UNION SELECT nickname FROM user_data SELECT * FROM tablea INNER JOIN tableb ON tablea.name = tableb.name SELECT AVG(uid) AS uidAvg FROM member SELECT COUNT(uid) AS uidAvg FROM member 计数 SELECT SUM(uid) AS uidAvg FROM member 总数 在 SQL 中增加 HAVING 子句原因是,WHERE 关键字无法与合计函数一起使用。 SELECT rid,SUM(zdl) FROM sys_hero WHERE rid < 20000000 GROUP BY rid HAVING SUM(zdl) >7800 LIMIT 0,10
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。