常用sql语句(mysql测试)

DB数据库,Database
DBMS数据库管理系统,DatabaMemanagmentSystem
SQL结构化查询语言,structure Query Language

开启服务
net start mysql80

登录
mysql -u root -p

显示数据库

show databases;

使用数据库
use mysql;

显示数据库表
show tables;
show tables from mysql;

显示数据库
select database();

desc stuinfo;

创建数据库
create database test;

创建数据库表

create table customer(id int,name varchar(20),password varchar(20),email varchar(30));

删除某列

alter table customer drop id;

插入一条数据
insert into stuinfo(id,name) values(1,'John');

查询
select * from stuinfo;

修改
update stuinfo set name='jack' where id=1;

删除
delete from stuinfo where id=1;

显示版本
select version();

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

猜你喜欢

转载自www.cnblogs.com/vocus/p/12231826.html