--创建一个数据库(test)
drop database if exists test;
create database test;
--删除数据库
drop database test;
--创建一个表(userInfo)
--注:当id为字增列时在插入数据的时候id对应的值应该为null
drop table if exists userInfo;
create table userInfo
(
id int auto_increment primary key,
name varchar(20) not null,
pwd varchar(20) not null
);
--插入数据
insert into userInfo values(null,'aaa','111');
insert into userInfo values(null,'bbb','111');
--更新数据
update userInfo set name='langwowo' where id=2;
--删除表
drop table userInfo;
--代码切换数据库
use user; --表示需要使用那个数据库
select * from userInfo; --具体的操作
drop database if exists test;
create database test;
--删除数据库
drop database test;
--创建一个表(userInfo)
--注:当id为字增列时在插入数据的时候id对应的值应该为null
drop table if exists userInfo;
create table userInfo
(
id int auto_increment primary key,
name varchar(20) not null,
pwd varchar(20) not null
);
--插入数据
insert into userInfo values(null,'aaa','111');
insert into userInfo values(null,'bbb','111');
--更新数据
update userInfo set name='langwowo' where id=2;
--删除表
drop table userInfo;
--代码切换数据库
use user; --表示需要使用那个数据库
select * from userInfo; --具体的操作