MySql基础操作
1. 创建表 CREATE TABLE test1( id int primary key ); 字段类型: 整数:tinyint, smallint, mediumint, int, bigint 浮点:float, double 字符:char(), varchar(), text 时间:date, time, datetime 字段属性: primary key unique key auto_increment not null default comment '' 2. 各种操作 数据定义DDL(对数据库的结构,名称等的操作): CREATE, DROP, ALTER CREATE TABLE test(列名 数据类型 属性,); ALTER TABLE test RENAME TO test1 ALTER TABLE test ADD id 数据类型 ALTER TABLE test CHANGE id uid 数据类型 ALTER TABLE test DROP COLUMN uid 数据操作DML: INSERT, UPDATE, DELETE INSERT INTO test(name, id) VALUES ('deng', 1) UPDATE test SET name='denghua' WHERE id=1 DELETE FROM test WHERE id=1 数据查询: SELECT, SELECT DISTINCT id FORM test SELECT * FORM test ORDER BY id asc 升序 desc 降序 事务控制: COMMIT, ROLLBACK, GRANT, REVOKE