标签:sql
使用datause mydata;
创建表);
往表里插数据inseert into toroto values(1,‘feifei‘);
显示所有的表show tables;
显示表里的数据select * from toroto;
left joinselect * from t1 left join t2 on t1.id = t2.id;
right joinselect * from t1 right join t2 on t1.id = t2.id;
显示所有的databaseshow databases;
显示表结构desc toroto;
从第3行往后选一行select * from toroto order by id desc limit 3,1;
删除表中的数据delete from toroto;
删除表drop table toroto;
auto_incrementinsert into toroto values (null,‘pangpang1‘);
只插name这一个元素insert into toroto (name) values (‘pangpang3‘);
显示当前时间select now();
在name后面加一列homealter table toroto add home varchar(100) after name;
删除home 这个字段alter table toroto drop home;
把id为1的name替换成baobaoupdate toroto set name = ‘baobao‘ where id = ‘1‘;
选出两张表中id相同的数据select * from toroto,toroto2 where toroto.id = toroto2.id;
选出表中id=2的数据标签:sql
原文地址:http://blog.csdn.net/lyy98521/article/details/45417899