命令行窗口中登录;
mysql -u -root -p
输入 xiaomi
set names utf8
truncate table t_cost_type //删除表中的所有内容,并且 自增长ID重新从1开始计数
show databases;
create database lesson;
use lesson;
//创建student数据库
create table student( id int primary key, name varchar(30) , age int , des varchar(50) );
//展示列信息
show columns from t_accounts_payable;
//增加列属性
alter table student add column name varchar(35);
//修改列属性(列名称+列属性)
alter table student modify name varchar(36);
alter table table_name old_column_name new_column_name int null;
alter table table_name alter column set default 12; //修改默认值
alter table table_name alter column column_name drop default;
sql语句:insert 时,varchar 类型的数据两边一定加上 ' '
//删除列属性
alter table student drop column name;
alter table student change column name name varchar(30) not null;
参考链接:http://www.cnblogs.com/hellojesson/p/6025548.html
三个表链接:
select id from table1 jon table2 on table1.name = table2.table1_name join table3 on table2.txt = table3.table2_txt