|
1、
SELECT * FROM t WHERE YEAR(d) >= 1994;
SELECT * FROM t WHERE d >= '1994-01-01';//这个好,相比上面的语句没有用year函数,
-------------------------------------------------------------------------------
2、
SELECT * FROM Country ,CountryLanguage
WHERE Country.Code= CountryLanguage.CountryCode;
SELECT * FROM Country JOIN CountryLanguage
ON Country.Code= CountryLanguage.CountryCode;//这个好,显式shuo(说)明了连接关系,以前好像在哪里看到过,记不起来了
-------------------------------------------------------------------------------
3、
SELECT * FROM t WHERE id = ‘19’;
SELECT * FROM t WHERE id = 19;//id she(设)置cheng(成)int类xing(型)的要比char或者archar的好?不是很明白
-------------------------------------------------------------------------------
4、
SELECT * FROM t WHERE length(column_t) = 5;
SELECT * FROM t WHERE column_length=5; //这个ye(也)不明白
--------------------------------------------------------
5、
SELECT * FROM t WHERE name LIKE '%de%‘
SELECT * FROM t WHERE name LIKE 'de%'
SELECT * FROM t WHERE name >= 'de' AND name < 'df‘//将like查询改成非like查询?ju(具)体例zi(子)什么意思不清楚
-------------------------------------------------------------------------------
6、
SELECT * FROM t WHERE 1;
SELECT * FROM t WHERE 1 LIMIT 10;这个也不懂
-------------------------------------------------------------------------------
7、
SELECT * FROM Country WHERE Name LIKE 'M%';
SELECT Name FROM Country WHERE Name LIKE 'M%';//只取需要的zi(字)段
在看yueliangdao0608的Mysql开发与优化的ppt时,看Dao(到)了上面的sql,所以拿出来请教下
http://www.javaxxz.com |
|