摘要:
创建表的同时将查询的结果写入到数据表中CREATE TABLE IF NOT EXISTS tbl_name [(create_definition,...)] select_statement 例:CREATE TABLE IF NOT EXISTS job(id SMALLINT UNSIGN... 阅读全文
摘要:
person(id,name,job,age)job(id,name)UPDATE person INNER JOIN job ON person.job=job.name SET person.job=job.id; 阅读全文
摘要:
SELECT id,name,price FROM goods WHERE price>=ANY (SELECT price FROM goods WHERE category='笔记本');注:ANY和SOME完全一样,表示子查询的任意一项ALL表示子查询的所有项>ANY,只要大于子查询的最小值就... 阅读全文
摘要:
SET NAMES gbk; 阅读全文
摘要:
INSERT [INTO] tbl_name SET col_name={expr|DEFAULT},...例:INSERT users SET username='kobe',age=35; 阅读全文
摘要:
将另一张表中的查询结果插入到指定的表中例:INSERT test(username) SELECT username FROM users WHERE age>=20;其中test(id,username),users(id, username,age) 阅读全文
摘要:
LIMIT {[offset,]row_count | row_count OFFSET offset}限制查询结果返回的数量例:SELECT * FROM users LIMIT 2;---出现头两条记录例:SELECT * FROM users LIMIT 3,2;---出现第4,5两条记录(从... 阅读全文
摘要:
select sex from users group by sex having age>=35 说明:having 中的字段必须是select 查询字段之一。select sex from users group by sex having count(id)>=2;说明:如果 having后面... 阅读全文