Mysql
thereisnospoon.
记录成长
展开
-
SQL基础查询语句(二)
####################### 多表连接查询# join left join / right join / inner joinselect a.*, b.province, b.area, c.category, c.small_category from spm_order as aleft join spm_area as b on a.city = b.cityleft join spm_product as c on a.product_id = c.product原创 2020-05-30 09:23:57 · 210 阅读 · 0 评论 -
SQL基础查询语句
###############################基础查询# 检索列SELECT order_id,product_id FROM spm_order# 查找销售人员select distinct sales_name from spm_order# 前100行数据select * from spm_order limit 100# where语句select * from spm_order where city in ('北京', '上海', '广州', '深圳', '原创 2020-05-26 22:34:19 · 207 阅读 · 0 评论 -
Mysql 学习笔记(六):索引,数据备份,事务,sql注入
数据准备索引原理#!/usr/bin/env python# -*- coding:utf-8 -*-# 什么是索引 -- 目录 # 就是建立起的一个在存储表阶段 # 就有的一个存储结构能在查询的时候加速# 索引的重要性 # 读写比例 : 10:1 # 读(查询)的速度就至关重要了# 索引的原理 # block 磁盘预读原理 ...原创 2019-11-02 09:06:27 · 74 阅读 · 0 评论 -
Mysql 学习笔记(五):单表与多表查询
表与表之间的关系#!/usr/bin/env python# -*- coding:utf-8 -*-# book :id name price author_id# author:aid name birthday gender# 作者与书 一对多# create table author(# aid primary key auto_increment,# name cha...原创 2019-10-30 16:49:48 · 154 阅读 · 0 评论 -
Mysql 学习笔记(四):约束与表,数据操作
约束#!/usr/bin/env python# -*- coding:utf-8 -*-# 约束 # unsigned 设置某一个数字无符号 # not null 某一个字段不能为空 # default 给某个字段设置默认值 # unique 设置某一个字段不能重复 # 联合唯一 # auto_increment 设置某一个in...原创 2019-10-30 16:34:24 · 78 阅读 · 0 评论 -
Mysql 学习笔记(三):数据类型
数值类型整数UNSIGNED(无符号) ,如果需要在字段里面保存非负数或者需要较大的上限值时,可以用此选项,它的取值范围是正常值的下限取 0,上限取原值的 2 倍,例如,tinyint 有符号范围是-128~+127,而无符号范围是 0~255。如果一个列指定为 zerofill,则 MySQL 自动为该列添加 UNSIGNED 属性。对于5种整数类型(tinyint、smallint、m...原创 2019-10-24 16:30:34 · 299 阅读 · 0 评论 -
Mysql 学习笔记(二):基础语句
Mysql登录与账号创建#进入mysql客户端$mysqlmysql> select user(); #查看当前用户mysql> exit # 也可以用\q quit退出# 默认用户登陆之后并没有实际操作的权限# 需要使用管理员root用户登陆$ mysql -uroot -p # mysql5.6默认是没有密码的#遇到password直接按回车键my...原创 2019-10-24 15:40:46 · 89 阅读 · 1 评论 -
Mysql 学习笔记(一):下载与安装
下载打开网址,https://www.mysql.com,点击downloads之后跳转到https://www.mysql.com/downloads下拉找到并点击MySQL Community (GPL) Downloads »选择下载MySQL Community Server默认最新版本,如果想要下载其他版本点击Looking for previous GA versio...原创 2019-10-24 15:20:23 · 199 阅读 · 0 评论