随笔分类 - Mysql
摘要:一:索引 如果没有索引,查找到指定对应数据后还是会向下全表查找, 索引是一种数据结构,比如二叉树 在字段上建索引的影响 1:占用磁盘空间,查询速度变快,是以空间换时间 2:对增删改语句效率有影响 二:视图 1:视图是基于基础表创建,是一个虚拟表,数据来源于基础表 2:视图和基础表可以互相修改数据 3
阅读全文
摘要:1:笛卡乐积 展示的内容以第一个表为主(不变),第二个表的数据每行重复展示 select * from employee_tbl,user 想要展示公共字段必须加表名 select user.name,date,address,chinese from employee_tbl,user where
阅读全文
摘要:--字段去重--distinct select distinct sname from student --排序--order by(ASC升序[默认] DESC降序)select distinct sage from student order by sage asc(先降序在去重) select
阅读全文
摘要:1:新增所有字段数据 insert into student values(10,'ss',10,'aa','162354587'),(11,'ss',1,'am','162354597'); 2:为部分字段添加数据 insert into student(name,age,address,ipho
阅读全文
摘要:1:创建表(表结构) 表的约数--default(默认值) not null(不能为空)primary key(主键字段的值不能为null和重复)unique(唯一但可以为null)auto_increment(自增长) create table student( id int(10) primar
阅读全文
摘要:1:创建 create database db2; 1.1:查看指定数据库的创建信息 show create database db2; 2:删除 drop database db2; 3:查看 show databases; 4:选择 use db1;
阅读全文