参考教程:http://www.yiibai.com/mysql/install-mysql.html#
1.创建库(不存在则创建,存在则不创建)
CREATE DATABASE IF NOT EXISTS JIANSHU DEFAULT CHAREST utf8 COLLATE utf8_general_ci
2.选择数据库
use JIANSHU
3.创建数据表
Create table if not exists ' jianshuarticle ' (
'_id' int unsigned auto_increment,
'_title' varchar(100) not null,
'_author' varchar(40) not null,
'submisson_date' DATE,
primary key ('_id')
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
4.增加数据
insert into jianshuarticle ('_title','_author','submisson_date') values ('MySQL的简单使用方法','mister','2017-12-20')
5.删除数据
delete from jianshuarticle
where _id=1
6.修改数据
update jianshuarticle
set
submisson_date='2017-12-21'
where
name='MySQL的简单使用方法'
7.查询数据
select _id,_title,_author
from jianshuarticle
where _id=1
limit 10;