MySQL 数据库基础与 SQL 操作

  • MySQL 特点:
  • 关系型数据库
  • 跨平台
  • 支持多种编程语言

  • 数据库管理:

  • 创建数据库:create database 库名;
  • 选择数据库:use 库名;
  • 显示数据库:show databases;
  • 删除数据库:drop database 库名;

  • 表管理:

  • 创建表:create table 表名 (字段名 数据类型, ...);
  • 显示表结构:desc 表名;
  • 查看表:show tables;
  • 删除表:drop table 表名;

  • 基本 SQL 命令:

  • 查询数据:select 字段名 from 表名;
  • 插入数据:insert into 表名 (字段名) values (值);
  • 更新数据:update 表名 set 字段名 = 值 where 条件;
  • 删除数据:delete from 表名 where 条件;
txt 文件大小:10.15KB