mac版Navicat如何设置重新打开后保持上次选项卡,在使用Navicat客户端时,我们可以设置重新打开客户端,保持上次打开的选项卡的,这个功能在哪里设置?我们来看一下。......
MySQL 数据库创建表
创建表
工具/原料
- 电脑
- MySQL软件
方法/步骤
创建数据库
指定字符集格式: create database 数据库名 character set gbk/utf8;
create database my002 character set gbk;
使用数据库:
use 数据库名;
use my002;
创建表
格式: create table 表名(字段名 字段类型,字段名 字段类型);create table student(name varchar(10),age int);
指定字符集格式: create table 表名(字段名 类型,字段名 类型) charset=utf8/gbk;create table person(name varchar(10),gender varchar(5))charset=gbk;
查询所有表
格式: show tables;
查询表详情
格式: show create table 表名;show create table person;
查看表字段
格式: desc 表名;desc student;
删除表
格式: drop table 表名:drop table student;
修改表名
格式: rename table 原名 to 新名;rename table person to t_person;
添加表字段
最后添加格式: alter table 表名 add 字段名 类型;
最前面添加:alter table 表名 add 字段名 类型 first;
在某个字段后面添加 alter table 表名 add 字段名 类型 after xxx;alter table t_person add salary int;alter table t_person add id int first;alter table t_person add age int after name;
删除表字段
格式: alter table 表名 drop 字段名;alter table t_person drop salary;
修改表字段
格式: alter table 表名 change 原名 新名 新类型;alter table t_person change age salary int;
删除数据库
drop database my002;
以上方法由办公区教程网编辑摘抄自百度经验可供大家参考!
相关文章
- 详细阅读
-
SQL Server 2005数据库恢复图文教程详细阅读
SQL Server 2005数据库恢复图文教程,相信很多的站长网站的时候需要用到SQLServer2005数据库,但是碰到一些问题没有办法恢复,本人专业学习的.et。平时也经常用到,希望能给大家带来......
2023-03-17 478 数据库
-
如何安装SQL Server 2008数据库(带完整图解)详细阅读
如何安装SQL Server 2008数据库(带完整图解),在电脑上安装SQLServer2008软件时,经常会遇到各种各样的问题,如何成功的安装SQLServer2008呢?提供完整过程和图片详解。......
2023-03-17 498 数据库