Select * from emp where empno=7900;
Select * from emp where ename='SMITH';
Select * from emp where sal > 2000 and sal < 3000;
Select * from emp where sal > 2000 or comm > 500;
select * from emp where not sal > 1500;
Select * from emp where comm is null;
Select * from emp where sal between 1500 and 3000;
Select * from emp where sal in (5000,3000,1500);
Select * from emp where ename like 'M%';
SELECT studentNO FROM student WHERE 0
SELECT studentNO FROM student WHERE 1
select * from people order by id
select * from people order by id desc
INSERT INTO Websites (name, url, country) VALUES ('stackoverflow', 'http://stackoverflow.com/', 'IND');
UPDATE Websites SET alexa='5000', country='USA' WHERE name='菜鸟教程';
DELETE FROM Websites WHERE name='百度' AND country='CN';
DROP test;删除表
TRUNCATE test;删除数据释放空间
DELETE FROM test 或者 DELETE * FROM test;删除数据不 释放空间
SELECT * FROM Websites LIMIT 2; 头两行数据
SELECT * FROM Websites WHERE alexa BETWEEN 1 AND 20;
SELECT * FROM Websites WHERE alexa NOT BETWEEN 1 AND 20;
SELECT * FROM Websites WHERE (alexa BETWEEN 1 AND 20) AND country NOT IN ('USA', 'IND')
SELECT name AS n, country AS c FROM Websites;
SELECT name, CONCAT(url, ', ', alexa, ', ', country) AS site_info FROM Websites;组合数据
SELECT w.name, w.url, a.count, a.date FROM Websites AS w, access_log AS a WHERE a.site_id=w.id and w.name="菜鸟教程"; 组合不同表数据
SELECT Websites.id, Websites.name, access_log.count, access_log.date FROM Websites INNER JOIN access_log ON Websites.id=access_log.site_id;