当前位置:网站首页>MySQL-DDL
MySQL-DDL
2022-06-21 11:47:00 【Jue Niu thunder plough hot blade】
/* DDL(Data Definition Language), Data definition language , The language section includes the following : 1. Common operations on Database 2. Common operations on table structure 3. Modify table structure */
# View all databases
show databases;
# Create database
# create database db;
# if not exists: Optional operation , Create... If it doesn't exist
create database if not exists db;
# Select database to use
use db;
# Delete database
# drop database db;
# if exists: Optional operation , Delete... If it exists
drop database if exists db;
# Modify database code
alter database db character set utf8;
# Create table
create table if not exists student
(
sid int,
name varchar(20),
gender varchar(10),
age int,
birthday date,
address varchar(20),
score double
);
# View all tables in the current database
show tables;
# View the creation statement of the specified table
show create table student;
# View table structure
desc student;
# Delete table
drop table if exists student;
# Modify table structure
# Add columns
alter table student
add dept varchar(20);
# Change column name and type
alter table student
change dept department varchar(30);
# Delete column
alter table student
drop department;
# Modify the name of the table
rename table student to stu;
边栏推荐
- Shell process control - 35. Multi branch case conditional statements
- Machine learning 2-linear regression
- 清除交换机配置、配置镜像端口以及Wireshark抓包(以Huawei S5720为例)
- IMU选型、标定误差分析、AHRS组合导航
- 阿宽食品:“方便食品第一股”争夺战继续
- Discussion on outsourcing safety development management and control
- Clear the switch configuration, configure the image port and Wireshark packet capturing (take Huawei s5720 as an example)
- QML入门到进阶
- 轻量级开源SAST工具semgrep分析1/2
- 2022安全员-B证复训题库及模拟考试
猜你喜欢

2022危险化学品经营单位安全管理人员特种作业证考试题库及在线模拟考试

Introduction to common source oscilloscope software and RIGOL oscilloscope upper computer software ns-scope

Heavyweight, mapstruct 1.5 was released. This time, it finally supports the transformation of map into bean!

Clear the switch configuration, configure the image port and Wireshark packet capturing (take Huawei s5720 as an example)

A Kuan food: the battle for "the first share of convenience food" continues

深水区涉入

QML入门到进阶

华为云发布桌面IDE-CodeArts

QML introduction to advanced

100w的数据表比1000w的数据表查询更快吗?
随机推荐
20N10-ASEMI中低压MOS管20N10
Formation harmonyos I
Operation and maintenance security, not so simple
Devsecops: s-sdlc enterprise best practices
五步成功完成威胁建模
2022安全员-B证复训题库及模拟考试
容器静态安全漏洞扫描工具Clair介绍
秘密法宝
harmonyos培訓一
矩形覆盖面积
When gdpr knocks
Adapter power supply automatic test equipment | introduction to charger ATE test system nsat-8000
numpy | 插入不定长字符数组测试OK
普源示波器软件,Rigol示波器上位机软件NS-Scope介绍
Getting started with data visualization
Matrial3d parameter analysis
Customization of power aging test system | overview of charging pile automatic test system nsat-8000
Citus 11 for Postgres is completely open source and can be queried from any node (citus official blog)
Hezhili: microbial driven carbon nitrogen sulfur phosphorus cycle in mangrove wetland sediments and its coupling mechanism
Use praise to improve performance