MySQL基础操作与表管理教程.pdfVIP

  • 1
  • 0
  • 约1.59千字
  • 约 4页
  • 2026-07-28 发布于北京
  • 举报

#查看当前有哪些数据库

showdatabases;

#使用名为test的数

据库usetest;

#创建一张学生表createtablestu(idint(10),namevarchar(20),ageint(10),primarykey(id));#每一张表都需要包含一个主

键,主键唯一标识一条记录,唯一的字段,不可重复且不能为空,通过`primarykey`关键字来定义。

#查看创建好的表

showcreatet

ablestu;

#新加一个字段altertablestuadd

columngendervarchar(20);

#修改一个字段altertablestumodify

columngendervarchar(40);

#删除一个字段altertablestu

dropcolumngender;

#删除表drop

tablestu;

#查看当前数据库中的

表showtab;

#向表中数据insertinto

stu(id,name,age)values(1,pw,28);

#全部字段时可以只写表名i

nsertintostu

values(2,nss,29);

#查看当前有哪些数据库

showdatabases;

#使用名为test的数据库

usetest;

#创建一

文档评论(0)

1亿VIP精品文档

相关文档