当前位置:网站首页>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;
边栏推荐
猜你喜欢
随机推荐
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
Excel quickly aligns the middle name of the table (two-word name and three-word name alignment)
为什么黑客领域几乎一片男生?
How useful is four-quadrant time management?
Why don't you make a confession during the graduation season?
【MySQL】Mysql范式及外键作用
Gorm—Go语言数据库框架
NPM Taobao mirror (latest version) released a new version of npm mirror at 2021-11-21 16:53:52 [easy to understand]
LeetCode二叉树系列——222.完全二叉树的节点个数
ES6 类
力扣:56. 合并区间
DBeaver连接MySQL 8.x时Public Key Retrieval is not allowed 错误解决
基于极限学习机(ELM)进行多变量用电量预测(Matlab代码实现)
工程水文学名词解释总结
Doing things software development - the importance of law and understanding of reasonable conclusions
TextBlock控件入门基础工具使用用法,取上法入门
Selenium自动化中无头浏览器的应用
女性服务社群产品设计
The role of /etc/profile, /etc/bashrc, ~/.bash_profile, ~/.bashrc files
thread_local 变量的析构顺序