使用data
create table longmao
(
depeno int primary key,
dname varchar(20),
loc varchar(20)
create table toroto
(
id int primary key auto_increment,
name varchar(20)
);
null
select * from toroto where id = 2;
use mydata;
创建表create table longmao
(
depeno int primary key,
dname varchar(20),
loc varchar(20)
);
往表里插数据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_incrementcreate table toroto
(
id int primary key auto_increment,
name varchar(20)
);
null
insert 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的数据select * from toroto where id = 2;