mysql
-h localhost -u -p
show databases
drop database test2
create database php;
use php;
show tables;
drop table tests;
create table class(
stu int,
age int,
area varchar(20)
);
create table score(
stu int,
name varchar(20),
kemu varchar(6)
);
rename table score to tabescore;
desc class;
打错输入\c退出
use php;
show tables;
desc msg;//打开msg表格
insert into msg
(id, title, name,content)
values
(1,'初来乍到',‘张三’, ‘刚来能不能当老大’);
set name gbk;
select *from msg
insert into msg
(id, title, name ,content)
values
(1,'又来了','李四','千年老二');
update msg
set
id = 2,
content = '偏要当老大'
where
name = '李四'
;
select * from msg;
insert into msg
(id, title, name, content)
values,
(3,'3标题','刘备','雌雄双剑',),
(4,'4标题','关羽','青龙偃月刀'),
(5,'5标题','张飞','丈八蛇矛');
select * from msg;
#删除
delete from msg
where id = 2;
;
#查询
select id, title from msg;
select * from msg where id > 2;
select id, content
from msg
where id >2;
-h localhost -u -p
show databases
drop database test2
create database php;
use php;
show tables;
drop table tests;
create table class(
stu int,
age int,
area varchar(20)
);
create table score(
stu int,
name varchar(20),
kemu varchar(6)
);
rename table score to tabescore;
desc class;
打错输入\c退出
use php;
show tables;
desc msg;//打开msg表格
insert into msg
(id, title, name,content)
values
(1,'初来乍到',‘张三’, ‘刚来能不能当老大’);
set name gbk;
select *from msg
insert into msg
(id, title, name ,content)
values
(1,'又来了','李四','千年老二');
update msg
set
id = 2,
content = '偏要当老大'
where
name = '李四'
;
select * from msg;
insert into msg
(id, title, name, content)
values,
(3,'3标题','刘备','雌雄双剑',),
(4,'4标题','关羽','青龙偃月刀'),
(5,'5标题','张飞','丈八蛇矛');
select * from msg;
#删除
delete from msg
where id = 2;
;
#查询
select id, title from msg;
select * from msg where id > 2;
select id, content
from msg
where id >2;