当前位置:网站首页>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;
边栏推荐
猜你喜欢

One's deceased father grind politics English average cent furnace! What is your current level?

Break down tasks

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

Use huggingface to quickly load pre training models and datasets in the moment pool cloud

QT operation on SQLite database multithreading

Introduction to the upper computer software ns-scope of Tektronix oscilloscope

Secret magic weapon

阿宽食品:“方便食品第一股”争夺战继续

2022年高压电工判断题及答案

Citus 11 for Postgres 完全开源,可从任何节点查询(Citus 官方博客)
随机推荐
C# Cannot access child value on Newtonsoft. Json. Linq. JProperty
Implementation of qcustomplot based on qtquick
广东发产品检测券,消费者也有份
『忘了再学』Shell流程控制 — 35、多分支case条件语句
Interesting research on mouse pointer interaction
One's deceased father grind politics English average cent furnace! What is your current level?
Simulated 100 questions of 2022 safety officer-a certificate examination and online simulated examination
QML introduction to advanced
Operation and maintenance security, not so simple
有意思的鼠标指针交互探究
站在数字化风口,工装企业如何“飞起来”
容器静态安全漏洞扫描工具Clair介绍
XML实体注入漏洞
DDoS attack and defense: from principle to practice
Harmonyos training I
Heavyweight, mapstruct 1.5 was released. This time, it finally supports the transformation of map into bean!
2022 safety officer-b certificate retraining question bank and simulated examination
boost一定要入门呀
Devsecops: ten things that should be done well
完美安全代码审计的5个最佳实践