MySQL_数据库的基本操作(增删改查)
数据库的基本操作
1、简单查看
show databases;
mysql> use test;
Database changed
show tables;
create database huanghuang;
drop database huanghuang;
2、查看当前使用的库
select database()
3、建表
create table test_1209ryc(id int,name varchar(20),age int,birthday datetime);
4、查看表结构信息
desc a;
5、插入数据:
insert into test_1209ryc values(001,"ryc006",16,"1991-01-01");
insert into test_1209ryc values(002,"ryc002",11,"1991-01-01");
insert into test_1209ryc values(003,"ryc003",11,"1991-01-01");
insert into test_1209ryc values(004,"ryc004",14,"1991-01-01");
insert into test_1209ryc values(005,"ryc005",15,"1991-01-01");
6、插入多行数据
insert into test_1209ryc(id,name,age,birthday) values (3,"zhao",10,"1981-11-10"),(77,"qian",8,"2010-1-1");
7、表数据内容
select * from test_1209ryc;
8、查看建表时候的描述
show create table test_1209ryc;
9、更改数据内容
update test_1209ryc set name="hhhhh" where name="ryc004";
update test_1209ryc set name="jason",age=20 where name="ryc005";