当前位置:网站首页>mysql黑窗口~建库建表
mysql黑窗口~建库建表
2022-07-31 15:14:00 【生活可真难啊】
// 创建一个数据库
create database 表名;
例如 create database drop_testdb;
//展示所有数据
show databases;
如下:

// 删除数据库
drop database <数据库名>;
// 查看表中的数据
select * from `test`;
// 展示所选择的字段内容
SELECT `id`, `name` FROM `test` WHERE 1
// 创建一个数据库
create database drop_database;
// 使用数据库
use drop_database;
// 展示数据库里的所有表
show tables;
// if exists 判断数据库是否存在,不存在也不产生错误
drop database if exists drop_database;
创建数据表
create table user(
id int primary key auto_increment,
username varchar(20) not null default ' ',
passwd char(32) not null default ' ',
email varchar(50) not null default ' ',
gender char(1) not null default ' ',
age tinyint unsigned not null default 0
)engine myisam charset utf8
// 删除数据表
drop table table_name;
// 往test表添加数据
INSERT INTO `test`(`id`, `name`) VALUES ('1','李四');
// 查看表中的数据
select * from `test`;
// 修改表中的数据
UPDATE `test` SET `id`='这是修改后的id',`name`='这是修改后的内容' WHERE `id`=1;
// 删除表中的数据
DELETE FROM `test` WHERE 1
// 在一个表里面增加一个字段
alter table user add email varchar(50) not null default ' ' after passwd;
// 设置显示字符集
set names gbk;
边栏推荐
- Matlab matrix basic operations (definition, operation)
- 【MySQL】Mysql范式及外键作用
- 01 Encounter typescript, build environment
- 《微信小程序-进阶篇》Lin-ui组件库源码分析-Icon组件
- 思路迪医药冲刺港股:5个月亏2.9亿 泰格医药与先声药业是股东
- The meaning of node_exporter performance monitoring information collection in Prometheus
- 力扣:714. 买卖股票的最佳时机含手续费
- 工程水文学名词解释总结
- radiobutton的使用
- MANIFEST.MF文件(PDB文件)
猜你喜欢

DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决

OpenShift 4 - Customize RHACS security policies to prevent production clusters from using high-risk registry

The meaning of node_exporter performance monitoring information collection in Prometheus

QGIS 加载WMS数据,重新投影

【CUDA学习笔记】初识CUDA

Jmeter常用的十大组件

工程流体力学复习

Message queue data storage MySQL table design

华医网冲刺港股:5个月亏2976万 红杉与姚文彬是股东

三、数组
随机推荐
Matlab matrix basic operations (definition, operation)
JVM parameter analysis Xmx, Xms, Xmn, NewRatio, SurvivorRatio, PermSize, PrintGC "recommended collection"
【MySQL】Mysql范式及外键作用
「秋招系列」MySQL面试核心25问(附答案)
TRACE32 - C source code association
AVH部署实践 (一) | 在Arm虚拟硬件上部署飞桨模型
charles进行弱网测试(app弱网测试怎么做)
Gorm—Go language database framework
R语言ggplot2可视化:使用ggpubr包的ggboxplot函数可视化分组箱图、使用ggpar函数改变图形化参数(caption、添加、修改可视化图像的题注、脚注内容)
leetcode303场周赛复盘
R language ggplot2 visualization: use the ggboxplot function of the ggpubr package to visualize the box plot, use the font function to customize the font size, color, style (bold, italic) of the legen
[MySQL] Mysql paradigm and the role of foreign keys
TCP详解
四象限时间管理有多好用?
01 邂逅typescript,环境搭建
华医网冲刺港股:5个月亏2976万 红杉与姚文彬是股东
PDF 拆分/合并
json到底是什么(c# json)
Ubantu project 4: xshell, XFTP connected the virtual machine and set xshell copy and paste the shortcut
11 pinia use