随笔分类 -  mysql / 基础

摘要:# 创建一个表# 需求:id 为主键,并自增;name 不能为空,且不可重复;age 年龄在 0-120 之间;status 状态默认为 1,gender 性别要求 无create table person( id int primary key auto_increment comment '主键 阅读全文
posted @ 2024-11-29 15:22 萧一下 阅读(4) 评论(0) 推荐(0) 编辑
摘要:# 字符串函数 # 拼接两个字符串 concat(字符串1, 字符串2) select concat('123', '456'); # 123456 # 字符串中所有字符转小写 lower(字符串) select lower('Hello'); # hello # 字符串中所有字符转大写 upper 阅读全文
posted @ 2024-11-28 15:21 萧一下 阅读(3) 评论(0) 推荐(0) 编辑
摘要:1、数据库操作、表操作 # 显示所有数据库 show databases # 创建数据库:create database 数据库名 CREATE database study_mysql # 使用数据库 use study_mysql # 创建表:create table 表名() comment 阅读全文
posted @ 2024-11-26 16:47 萧一下 阅读(16) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示