DDL与DML的区别

基本定义

  • DML(Data Manipulation Language) 数据操纵语言

适用范围:对数据库中的数据进行一些简单操作,如insert,delete,update,select

  • DDL(Data Definition Language) 数据定义语言

适用范围:对数据库中的某些对象(例如database,table)进行管理,如create,alterdrop

DDL(数据定义语言, Data Definition Language)

建库、建表、设置约束等:create\drop\alter

1、创建数据库

create database if not exists appblog character set utf8;

2、创建表

use appblog;
create table if not exists stud(
id int,
name varchar(30),
age int
);

3、更改表结构(设置约束)

desc stud; //查看表结构
alter table stud drop column age;
alter table stud add column age int;

4、删除表、删除数据库

drop table stud;
drop database appblog;

DML (数据操纵语言, Data Manipulation Language )

主要指数据的增删查改: select\delete\update\insert

select * from stud;
select name,age from stud; //查询指定的列
select name as 姓名, age as 年龄 from stud;
上一篇 四个好看的CSS样式表格
下一篇 MySQL LIKE 子句
目录
文章列表
1 Spring Boot中HandlerInterceptor和Filter区别及使用
Spring Boot中HandlerInterceptor和Filter区别及使用
2
CentOS下部署Jenkins
CentOS下部署Jenkins
3
Spring Security Oauth2 中优雅的扩展自定义(短信验证码)登录方式
Spring Security Oauth2 中优雅的扩展自定义(短信验证码)登录方式
4
FastJson中@JSONField注解使用
FastJson中@JSONField注解使用
5
aws ssm send-command 执行无效果解决
aws ssm send-command 执行无效果解决
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。