mysql 1

//drop database <数据库名>;
mysql -uroot -p(密码)
CREATE DATABASE IF NOT EXISTS RUNOOB DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

show databasees;
use 库名;
//进入库

show tables;
//查看说有表
CREATE TABLE IF NOT EXISTS `runoob_tbl`(
   `runoob_id` INT UNSIGNED AUTO_INCREMENT,
   `runoob_title` VARCHAR(100) NOT NULL,
   `runoob_author` VARCHAR(40) NOT NULL,
   `submission_date` DATE,
   PRIMARY KEY ( `runoob_id` )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

desc 表名; //查看表
DROP TABLE table_name ;   //删除表
//插入数据
INSERT INTO runoob_tbl
(runoob_title, runoob_author, submission_date)
values
("学习 PHP", "菜鸟教程", NOW());
INSERT INTO runoob_tbl 
(runoob_title, runoob_author, submission_date)
values
("学习 Java", "菜鸟教程", NOW());
INSERT INTO runoob_tbl 
(runoob_title, runoob_author, submission_date)
values
("学习 HTML", "菜鸟教程", NOW());
 
select * from runoob_tbl;   //读取表数据
 
posted @ 2018-10-10 18:38  ThisCall  阅读(181)  评论(0编辑  收藏  举报