赞
踩
1. 查询语句:
sql SELECT * FROM table_name; //查询表中所有列 SELECT column_name FROM table_name; //查询指定列 SELECT * FROM table_name WHERE condition; //条件查询 SELECT column_name FROM table_name WHERE condition ORDER BY column_name; //排序查询 SELECT COUNT(*) FROM table_name; //统计查询 SELECT * FROM table_name LIMIT n; //限制查询结果的前n行
2. 插入语句:
sql INSERT INTO table_name (column_name1, column_name2, ...) VALUES (value1, value2, ...);
3. 更新语句:
sql UPDATE table_name SET column_name1=value1, column_name2=value2 WHERE condition;
4. 删除语句:
sql DELETE FROM table_name WHERE condition;
5. 创建表:
sql CREATE TABLE table_name ( column_name1 type, column_name2 type, ... );
6. 修改表:
sql ALTER TABLE table_name ADD column_name type; //增加列 DROP COLUMN column_name; //删除列 MODIFY COLUMN column_name type; //修改列类型
7. 删除表:
sql DROP TABLE table_name;
8. 其他语句:
sql SHOW DATABASES; //显示数据库列表 USE database_name; //选择数据库 SHOW TABLES; //显示数据表列表 DESC table_name; //显示数据表结构
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。