(1)登陆:mysql -u root -p;
(2)查看数据库:show databases;
(3)新建数据库:create database trade;
(4)使用数据库:use trade;
(5)删除数据库:drop database trade;
(6)新建表:
create table employee(id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,firstname varchar(25) NOT NULL,lastname VARCHAR(25) NOT NULL,email VARCHAR(45) NOT NULL,phone VARCHAR(10) NOT NULL,PRIMARY KEY(id));
(7)查看数据库中可用的表:show tables;
(8)查看表结构:两种写法:
desccribe employee;
show colunmns in employee;
(9)删除表:drop table employee;
(10)给表设置值:
insert into employee(id,firstname,lastname,email,phone)values(1,"xi","zeng","1050495071@qq.com","18970882810");