sql语法
2020-08-10 本文已影响0人
无花无酒_3cd3
查询
select ip from list where ip like "mama"
SELECT * FROM list
WHERE a> 15
AND (country='CN' OR country='USA');
1、ORDER BY排序
ORDER BY 关键字用于对结果集按照一个列或者多个列进行排序。
ORDER BY 关键字默认按照升序对记录进行排序。如果需要按照降序对记录进行排序,您可以使用 DESC 关键字。
SELECT * FROM Websites
ORDER BY country,alexa DESC;
2、插入
INSERT INTO Websites (name, url, country)
VALUES ('stackoverflow', 'http://stackoverflow.com/', 'IND');
3、跟新
UPDATE Websites
SET alexa='5000', country='USA'
WHERE name='菜鸟教程';
删除
DELETE FROM Websites
WHERE name='Facebook' AND country='USA';
高级语法
限制
SELECT * FROM Websites LIMIT 2;
别名
select event_id AS A from am_alarm_record ;