随笔分类 - Mysql基础
摘要:一、python操作 mysql # pip install pymysql 1、基本语法 # (1) 创建连接 host user password database 这四个参数必须写 conn = pymysql.connect(host="127.0.0.1",user="root",pass
阅读全文
摘要:sql查询语句的完整语法: # select .. from .. where .. group by .. having .. order by .. limit .. 一、单表查询 建表语句: create table employee( id int not null unique auto_
阅读全文
摘要:一、约束 """ unsigned 无符号 not null 不为空 default 设置默认值 unique 唯一约束,数据唯一不重复 primary key 主键,标记数据的唯一特征(唯一且不为空) auto_increment 自增加1(一般配合主键使用, 或 unique进行自增) zero
阅读全文
摘要:一、MySQL客户端命令介绍 1、mysql命令的作用 1.1、用于连接数据库 1.2、用于管理数据库 通过命令接口自带命令 """ 1、\h 或 help 或 ? 2、\G 可以把查询出来的表格式化 3、\T 或 tee 记录一下日志 tee /tmp/a.log sql语句执行后记录在a.log
阅读全文