MySQL安装和简单操作
MySQL数据库安装与配置详解
MySQL的安装请参考下面这篇博客,讲述的非常详细,各种截图也很清晰。
http://www.cnblogs.com/sshoub/p/4321640.html
MySQL简单操作
大家可以安装下面的这个博客来进行一些简单的MySQL的操作,讲得非常详细,有语法和具体实例。
http://www.runoob.com/mysql/mysql-tutorial.html
- 创建一个表
书名 出版社CREATE TABLE runoob_tbl( runoob_id INT NOT NULL AUTO_INCREMENT, runoob_title VARCHAR(100) NOT NULL, runoob_author VARCHAR(40) NOT NULL, submission_date DATE, PRIMARY KEY ( runoob_id ) );
- 在表里插入数据
INSERT INTO runoob_tbl (runoob_title, runoob_author, submission_date) VALUES ("学习 PHP", "菜鸟教程", NOW());
INSERT INTO runoob_tbl (runoob_title, runoob_author, submission_date) VALUES ("学习 Python", "菜鸟教程", NOW());
INSERT INTO runoob_tbl (runoob_title, runoob_author, submission_date) VALUES ("学习 MySQL", "菜鸟教程", NOW());
- 查询表里的数据
select * from runoob_tbl;
- show databases;
- create database example;
- use example;
- show databases;
- create database example;
- use example;
- drop database example;
- create database example;
- use example;
创建一个表,有以下属性
id name author publish_date - CREATE TABLE book(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
author VARCHAR(40) NOT NULL,
publish_date DATE,
PRIMARY KEY ( id )
);
insert into book (name, author, publish_date) values ("learn django", "yating","2016-09-01");
select * from book where name="learn mysql" and id=1;
select name, author from book;