《MySQL必知必会》读书笔记

《MySQL必知必会》读书笔记

第1-3章MySql简单命令行操作

mysql --help 帮助信息
mysql -u userName -p 用户登录
show databases; 列出当前所有数据库
use databaseName 使用当前数据库
show tables; 列出当前数据库所有的表
show columns from tableName; 查看表结构

第2章customers表

第4章数据检索

select 语句的简单使用,先创建模板数据库 crashcourse

-- 快捷键:运行选中的sql, ctrl + r
show COLUMNS FROM products;
-- 检索单列数据
select prod_name from products;
-- 检索多列数据,列名与列名之间使用逗号进行分隔
select prod_id, prod_name,prod_price from products;
-- 检索所有的列使用通配符*号
select * from products;
-- 对于检索出来的列的值进行去重(注意这里只检索了1列),在select后面使用select 后面添加上 distinct 关键字; 
-- 注意distinct作用域该关键字之后的所有列,理解为所有列的组合后去重
select distinct vend_id from products;
-- 使用limit start,size 返回指定开始行和行数,注意start下标是从0开始
select * from products;
select * from products limit 0,5;
-- 使用完全限定名:表名.字段名, 数据库名.表名 来指定操作的列/表 ,使用限定名在navicat中会有列名提示
select products.prod_id from crashcourse.products;

第5章排序检索数据

-- 使用order by 关键字对检索结果按照指定列的值进行排序 默认升序:英文字符串按照a-z的顺序,数组0-n; 
-- 优先级 . > 数字 > 英文 
-- 默认升序-asc 降序关键字-desc
select prod_name from products order by prod_name;
-- 按多个列排序,order by 关键字后面按照排序的优先级从高到低,使用逗号分隔添加排序的参照列
select prod_id, prod_price,prod_name from products order by prod_price, prod_name;
-- 使用order by + limit 的组合可以找到指定列中的最大值或最小值; limit 1 表示仅返回一行
select prod_price from products order by prod_price desc limit 1;

第6章过滤数据

-- 可以使用 where 关键字对查询结果进行过滤, where 条件表达式 order by 排序参照字段
select prod_name, prod_price
from products
where prod_price =2.50;
-- where 操作符  <> 和 != 的区别是什么? between 指定的两个值之间
-- mysql 在执行匹配的时候不区分大小写
select prod_name, prod_price 
from products
where prod_name = 'fuses'
-- 使用 <> 或者 != 进行不匹配检查
select vend_id, prod_name
from products
where vend_id <> 1003;
-- 使用between进行范围值检查, 注意 between是包含边界值的
select prod_id, prod_name, prod_price
from products
where prod_price between 5 and 10;
-- 使用is null 进行控制检测,注意例如 0 这样的值不是空值,空值指的是 null
select cust_id, cust_name 
from customers
where cust_email is null;
-- 那mysql的非空检测呢?判断NULL用is null 或者 is not null ;判断空字符串,要用 =”或者 <>”
select cust_id, cust_name 
from customers
where cust_email is not null;

第7章数据过滤(where查询的高级使用)

-- 使用and(都满足) or(只要满足一个) 连接多个条件表达式
select vend_id, prod_id, prod_name
from products
where vend_id = 1003 and prod_price <=10;
-- 销售商id = 1002 或者 1003
select vend_id, prod_id, prod_name
from products
where vend_id = 1003 or vend_id = 1002;
-- 逻辑运算符的优先级,一般使用()去提升优先级
-- 列出价格10美元(含)以上且由1002或1003制造的产品
select vend_id, prod_name, prod_price
from products
where (vend_id = 1002 or vend_id = 1003) and prod_price >= 10
-- in 操作符表示能够和提供的多个值中匹配上一个,就将整条记录查询出来,可以和or关键字进行替换,in比较清晰直观
select vend_id, prod_id, prod_name
from products
where vend_id in(1002,1003)
order by prod_name;
-- not 运算符用来否定之后的条件表达式
select vend_id, prod_id, prod_name
from products
where vend_id not in(1002,1003)
order by prod_name;

第8章用通配符进行过滤

-- 使用like运算符进行模糊搜索 %-表示0-n个任意字符 _表示1个任意字符 %keyWord% 表示包含搜索内容
-- 产品名称"jet"打头
select prod_id, prod_name
from products
where prod_name like 'jet%';
-- like 匹配是可以区分大小写?那怎么区分大小写呢?
-- 方式一在创建表的时候指定字段区分大小写;方式二在查询的时候指定字符集 collation
select prod_id, prod_name
from products
where prod_name collate latin1_bin like 'Jet%';
-- 查询产品名包含 anvil
select prod_id, prod_name
from products
where prod_name like '%anvil%';
-- 查询产品名指定开头和结尾
select prod_id, prod_name
from products
where prod_name like 's%e';
-- _ 通配符
select prod_id, prod_name
from products
where prod_name like '_ ton anvil';

第9章使用正则表达式进行搜索(未完成)

第10章创建计算字段(未完成)

第11章使用数据处理函数

-- 文本处理函数 RTrim 去除右侧的空格 Upper转大写
select vend_name, RTrim(vend_name) as name_rtrim, Upper(vend_name) as name_upper
from vendors
order by vend_name;
-- 常用的文本处理函数:left-返回串左边,length-返回长度,locate-找出子串,lower-转小写,ltrim-去除左边空格
-- right-返回右边字符串,rtrim-去掉右边空格,substring-截取,upper转大写,soundex-返回soundex值

-- 日期时间处理函数
-- addDate-增加日期(天、周),addTime-增加时间(时、分),curDate-当前日期,curTime当前时间,date-返回日期时间的日期部分
-- dateDiff-返回日期差,data_format-返回格式化的日期或时间串,day-返回天数(月),dayOfWeek-返回天数(周),hour-小时
-- minute-分钟,month-月份,now-日期时间,second-秒,time-返回时间,year-返回年份
-- 日期格式必须为 yyyy-mm-dd
-- 查询指定日期的订单信息
select order_num, order_date
from orders
where order_date = '2005-09-01'
-- 注意当字段的数据类型为 datetime 时,order_date = '2005-09-01' 能够和数据 2005-09-01 00:00:00 匹配上,但是和2005-09-01 05:30:34就匹配不上了
-- 可以只比较日期部分,使用date函数
select order_num, order_date
from orders
where Date(order_date) = '2005-09-01'
-- 检索指定月份的订单
-- 方式一:between 月份第一天和最后一天的日期,但是需要自己去判断这个月的天数,不推荐
select order_num, order_date
from orders
where Date(order_date) between '2005-09-01' and '2005-09-30'
-- 方式二:使用Year,Month函数(月份从1开始)
select order_num, order_date
from orders
where YEAR(order_date) = 2005 and MONTH(order_date) = 9

-- 数值处理函数
-- ads-绝对值,mod-取余,round-随机数

第12章汇总数据

-- 聚合函数:count-统计行数,sum-求和,avg-平均数,max-最大值,min-最小值
-- avg 产品平均价格,注意avg会忽略null值
select avg(prod_price) as avg_price
from products
-- 指定销售商下所有产品的平均价格,先进行where删选,在对筛选结果进行avg操作
select avg(prod_price) as avg_price
from products where vend_id = 1003
-- count(*) 统计行数无论列中是否包含null值,count(column) 忽略指定列的null值,统计行数
select count(*) as num_cust
from customers;
select count(cust_email) as num_cust
from customers;
-- max-最大值,忽略null
select MAX(prod_price) max_price
from products;
-- min-最小值,忽略null
select MIN(prod_price) min_price
from products;
-- sum 指定订单下物品的数量
select SUM(quantity) as items_ordered
from orderitems
where order_num = 20005;
-- sum 两个字段进行数学运算之后的值(计算订单总金额)
select SUM(quantity*item_price) as totol_price
from orderitems
where order_num = 20005;
-- 聚集不同值,用到distinct关键字 (特定销售商家下不同价格的平均价格)
select avg(distinct prod_price)
from products
where vend_id = 1003
-- 组合聚合函数,结果集中可以包含多个聚集函数
select count(*) as item_num, min(prod_price), max(prod_price), avg(prod_price)
from products

第13章分组数据

分组数据:将结果集按照指定字段,根据字段相同,换分为更小的组,经常使用聚合函数对划分的组进行数据统计

-- group by 后面只能够是分组字段或者表达式(什么样的表达式呢)
-- select 后面只能够接分组字段或者聚合函数结果;
-- 如果分组列中存在null值,那么null值所在行会被划分到一组
-- 使用 group by 关键字查询不同销售商有多少产品
select vend_id, count(*) as vend_num
from products
group by vend_id
-- 对分组之后的数据再次进行过滤,使用having关键字,where是对分组前的数据进行分组
select vend_id, count(*) as vend_num
from products
group by vend_id
having count(*) >= 2
-- 按销售商分组,数量2个(含)以上,价格10(含)以上
select vend_id, count(*) as vend_num
from products
where prod_price >=10
group by vend_id
having count(*) >= 2
-- 在group by 子句后面添加上order by 表示对分组之后的数据进行排序,having子句中不能够使用别名,要使用聚合函数或者表达式
-- 检索所有订单总金额,升序排序,总金额大于50
select order_num, sum(item_price * quantity) as total_price 
from orderitems
group by order_num
having sum(item_price * quantity) > 50
order by total_price 
-- select 查询语句顺序
-- select distinct from where group by having order by limit

第14章使用子查询

子查询:将查询出来的结果作为条件表达式的一部分,或者将结果集当做一张新的表;也可以理解为将多条查询语句转换为一条查询语句。

-- 利用子查询进行过滤
-- 查询购买过TNT2的所有客户
select order_num from orderitems where prod_id = 'TNT2'
select cust_id from orders where order_num = 20005
select cust_name from customers where cust_id = 10001
show columns from customers
show columns from orders
-- 子查询
select cust_name, cust_contact
from customers
where cust_id in (
	select cust_id
	from orders
	where order_num in(
		select order_num
		from orderitems
		where prod_id = 'TNT2'
	)
)
-- 作为计算字段使用子查询
-- 查询每个用户的订单数量以及用户基本信息
select cust_id, cust_name, cust_state from customers
select count(*) as order_sum from orders where cust_id = 10001
-- 子查询
select cust_name, cust_state, (select count(*)
	from orders 
	where orders.cust_id = customers.cust_id) as order_sum 
from customers
-- 上方案例也叫做相关子查询 customer.cust_id 是来自于外部表

第15章联结表

联结表:将2张表或多张表联结成一张表进行数据查询

联结方式:

  • 自然连接 from table1, table2
  • 内连接 table1 inner join table2 on 联结条件
  • 外连接(左外,右外) table1 left join table2 on 联结条件

为什么使用多表?

举例,一个厂家生产多个产品,如果每一条产品信息都需要插入厂家相关信息,厂家信息会冗余,也容易插入错误厂家信息,当修改厂家的信息的时候会去修改每一条产品信息,浪费空间,时间。所以会将产品和厂家放到两张表中,通过厂家id进行联结。

-- 创建简单连接
select vend_name, prod_name, prod_price
from products, vendors
where products.vend_id = vendors.vend_id
order by vend_name, prod_name
-- 没有添加联结关系的表,进行联结查询返回的是笛卡尔积,表1中的1行和表2中的每一行进行拼接
-- 使用 inner join 进行内连接
select vend_name, prod_name, prod_price
from products inner join vendors
on products.vend_id = vendors.vend_id
order by vend_name, prod_name
-- 连接多张表(显示编号20005订单中的物品)
select prod_name, vend_name, prod_price, quantity
from products, vendors, orderitems
where products.vend_id = vendors.vend_id 
	and orderitems.prod_id = products.prod_id
	and orderitems.order_num = 20005
-- 查询购买过TNT2的所有客户(多表连接版本)
-- customers, orderitems,
select distinct cust_name
from customers, orders, orderitems
where orderitems.order_num = orders.order_num
	and orders.cust_id = customers.cust_id
	and orderitems.prod_id = 'TNT2'

第16章创建高级联结

-- 使用表别名 table as alais
select distinct cust_name
from customers as c, orders as o, orderitems as oi
where c.cust_id = o.cust_id
	and o.order_num = oi.order_num
	and oi.prod_id = 'TNT2'
-- 使用不同类型的联结
-- 自联结 一张表自己联结自己(找到prod_id为DTNTR的物品的供应商,以及这个供应商下的其他商品)
select p1.prod_id
from products p1 inner join products p2
on p1.vend_id = p2.vend_id
where p2.prod_id = 'DTNTR'
-- 自然联结 自然联结排除相同列的多次出现,对于某一张表使用 select tableName.*, 并且补充其没有的列
-- 查询产品id为 'FB'的产品,在那些被哪些顾客购买,购买的订单,订单详情
select * from orderitems
select c.*, o.order_num, o.order_date,
				oi.prod_id, oi.quantity, oi.item_price
from customers as c, orders as o, orderitems as oi
where c.cust_id = o.cust_id
	and o.order_num = oi.order_num
	and oi.prod_id = 'FB'
-- 外部联结 联结包含了那些在相关表中没有关联行的行
--  表A中的行和表B中的行进行关联,当表B中的没有和表A中的行进行关联的行,
-- 但是又需要展示表A中的无法创建关联的行的数据时,可以使用外联结
-- 查询所有顾客的订单号
select c.cust_name, o.order_num
from customers as c
left outer join orders o
on c.cust_id = o.cust_id
-- 使用在聚集函数的联结
-- 检索所有顾客的订单数量(为什么cust_name能够直接查出来)
select c.cust_name, c.cust_id, count(o.order_num)
from customers as c
inner join orders o
on c.cust_id = o.cust_id
group by c.cust_id;

第17章组合查询(未完成)

第18章全文本搜索(未完成)

第19章插入数据

-- 插入完整行数据,自增字段不需要插入数据,所以传递null值;数据需要和字段匹配
insert into customers values(null,'Pep E. LaPew','100 Main Street','Los Angeles','CA','90046','USA',null,null);
select * from customers;
-- 插入数据的时候指定字段,字段名的顺序不重要,字段名只需要和值对应就行
insert into customers(cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country,cust_contact,cust_email)
value ('Pep E. LaPew','100 Main Street','Los Angeles','CA','90046','USA',null,null);
-- 可以一次插入多行数据,只要值和字段对应就行
insert into customers(cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country)
values('Pep E. LaPew','100 Main Street','Los Angeles','CA','90046','USA'),
('M. Martin','42 Galaxy Way','New York','NY','11213','USA');
-- 将检索出来的数据插入到表中,不需要values字段,直接将查询语句接在字段后面就可以
insert into customers(cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country,cust_contact,cust_email) 
select cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country,cust_contact,cust_email from customer_new;

第20章更新和删除数据

-- 关键字update 更新语句一定要带上 where 条件,不然会更新整张表
select * from customers;
update customers
set cust_email = 'elmer@fudd.com'
where cust_id = 10005;
-- 在update语句中可以使用子查询的结果更新指定的字段
-- ignore 关键字,当更新多行时,即使某一行更新失败,剩余行也会继续进行更新
-- 删除某列的值
update customers
set cust_email = null
where cust_id = 10005;
-- 删除数据 关键字 delete,同时也需要记住带上where条件
delete from customers
where cust_id = 10009;
-- truncate table table_name 表示删除整张表的内容,原理是删除整张表后,重新创建一张新的表
-- update delete 使用注意事项
-- 带上where条件,进行update和where操作之前需要使用select语句进行查找

第21章创建和操纵表

-- 21.1 使用SQL创建数据表
-- create table table_name(column_name datatype,) ENGINE=engine_name 是这样?
create table customers
(
	cust_id 			int	not null auto_increment,
	cust_name 		char(50) not null ,
	cust_address	char(50) null ,
	cust_city 		char(50) null ,
	cust_state 		char(5) null,
	cust_zip 			char(10)	null	,
	cust_country	char(50)	null	,
	cust_contact	char(50)	NULL	,
	cust_email		char(50)	NULL	,
	PRIMARY	KEY	(cust_id)
)	ENGINE=INNODB;
-- 数据库引擎:INNODB 是事务处理引擎不支持全文本搜索 MEMORY==MyISAM 支持全文本搜索,不支持事务
-- null, not null 表明字段可为空/不可为空,当字段为null时表示插入数据的时候该字段可以不赋值;not null 表示必须带值
-- aotu_increment 表示字段自增长,默认种子值为:1,增长间隔为:1
-- PRIMARY KEY 声明主键字段
-- 联合主键,由两个字段的组合组成主键,组合不能够重复
create table orderitems
(
	order_num		INT		not NULL	,
	order_item	INT		NOT	NULL	,
	prod_id			CHAR	NOT	NULL	,
	quantity		INT		NOT	NULL	,
	item_price	DECIMAL(8,2)	NOT	NULL	,
	PRIMARY KEY	(order_num,order_item)
) ENGINE= INNODB
-- create table if not EXISTS table_name(); 创建表之前先判断表是否存在
-- 查询最后一条插入语句返回的自增长id 
select LAST_INSERT_ID();

-- 21.2 更新表(修改表结构)关键字 alter table
-- 当表已经存放数据了就不建议对表结构进行修改,可能会触发约束限制,表与表之间也会创建联系,字段之间也会创建关联
-- 21.2.1 删除表的某一列
ALTER	TABLE	vendors
DROP	COLUMN	vend_phone;
-- 21.2.2 ALTER创建外键关系,在两张可以建立外键关系的表创建完成之后,可以通过alter	语句添加外键关系
ALTER	TABLE	orderitems
ADD	CONSTRAINT	fk_orderitems_order
FOREIGN	KEY(order_item) REFERENCES	orders(order_num);
-- 语法总结
ALTER	TABLE	外键表名
ADD	CONSTRAINT	外键约束名称(fk_外键表名_主键表名)
FOREIGN	KEY(外键表外键字段) REFERENCES 主键表(主键字段)

-- 21.3 删除表 drop table
-- drop 不仅仅删除表数据还删除表结构
drop table customers2;

-- 21.4 重命名表
RENAME	TABLE	customers2	TO	customers

第22章使用视图

视图:视图是一张虚拟的表,定义了要查询的数据,自身并不包含数据;可以理解为就是某条查询语句的结果集

视图使用场景:

  • 常用的重复的SQL
  • 方便进行下一步查询的重用
  • 只使用表中的部分数据
  • 保护数据,可以为视图添加访问权限

视图使用:把视图当做一张表,直接使用 select 关键字就行

常用命令:

create view -- 创建视图
show create view view_name;	-- 查看视图创建语句
drop view view_name; -- 删除视图
create or replace view -- 直接创建或者替换视图
-- 22.1 创建视图 create view	view_name	AS	SELECT子句
CREATE	VIEW	productcustomers	AS	
SELECT	cust_name,	cust_contact,	prod_id
FROM	customers,	orders,	orderitems
WHERE	customers.cust_id	=	orders.cust_id
	AND	orderitems.order_num	=	orders.order_num;
-- 使用视图
SELECT	*	FROM	productcustomers;
-- 22.2 使用视图格式化检索出来的数据(需要经销商+地区的拼接字段)
CREATE OR	REPLACE	VIEW	vendorlocations	AS
SELECT	CONCAT(TRIM(vend_name),	' (',	TRIM(vend_country),	') ') 
	AS	vend_title
FROM	vendors
ORDER BY	vend_name;
-- 22.3 使用视图过滤不想要的数据(过滤没有电子邮件的用户)
CREATE view customeremaillist AS
SELECT cust_id, cust_name, cust_email 
FROM customers
WHERE cust_email IS NOT NULL;
SELECT * FROM customeremaillist;
-- 22.4 使用视图与计算字段(查询指定订单中每种物品的总价格)
CREATE VIEW orderitemsexpended AS
SELECT prod_id,quantity, item_price, item_price*quantity AS expanded_price
FROM orderitems
WHERE order_num = 20005;
SELECT * FROM orderitemsexpended;
-- 22.5 更新视图
-- 通常视图是可以更新的,视图更新实际上更新的是基表的数据,但不是所有的视图都能够被更新
-- 在视图是使用了分组,联结,聚合函数,DISTINCT 等操作,视图是不能够被更新的
-- 2.6 删除视图
DROP VIEW IF EXISTS vendorlocations;

第23章使用存储过程

存储过程:将多条SQL语句进行封装,加上业务逻辑

为什么使用存储过程:

  • 简化复杂操作
  • 防止出错,保证数据的完整性
  • 简化变动的管理,外部的调用不用发生变化,只需要修改内部的逻辑
  • 提高性能,一次创建多次调用
-- 23.1 创建存储过程 CREATE PROCEDURE PROCEDURE_NAME BEGIN SELECT子句 END;
-- 创建一个放回产品平均价格的存储过程
CREATE PROCEDURE productpricing()
BEGIN
 SELECT AVG(prod_price) AS priceaverage
 FROM products;
END;
-- 23.2 执行存储过程 CALL PROCEDURE_NAME;
CALL productpricing();
-- 23.3 删除存储过程 DROP PROCEDURE PROCEDURE_NAME
DROP PROCEDURE productpricing;
-- 23.4 创建带参数的存储过程,存储过程一般不直接显示查询结果,返回查询的值
-- 在存储过程中使用变量临时存储数据
-- 创建带输出参数的存储过程,获取产品表中最高,最低,平均价格
CREATE PROCEDURE productpricing(
 OUT pl DECIMAL(8,2),
 OUT ph DECIMAL(8,2),
 OUT pa DECIMAL(8,2)
)
BEGIN
 SELECT MIN(prod_price)
 INTO pl
 FROM products;
 SELECT max(prod_price)
 INTO ph
 FROM products;
 SELECT AVG(prod_price) 
 INTO pa
 FROM products;
END;
-- 23.5 调用带参数的存储过程,使用@变量名方式
CALL productpricing(
 @price_low,
 @price_high,
 @price_avg
);
SELECT @price_low, @price_high, @price_avg;
-- 23.6 同时使用in, out 参数(接受订单号,返回该订单合计)
CREATE PROCEDURE ordertotal(
	IN onumber INT,
	OUT ototal DECIMAL(8,2)
)
BEGIN
	SELECT SUM(item_price * quantity)
	FROM orderitems
	WHERE order_num = onumber
	INTO ototal;
END;
CALL ordertotal(20009, @total);
SELECT @total;
-- 23.7 创建带逻辑判断的存储过程 (有的洲的顾客订单总金额需要添加营业税)

-- Name:ordertotal
-- Parameters: onumber = order number
--             taxable = 0 if not taxable, 1 if taxable
--             ototal  = order tatal varible
CREATE PROCEDURE ordertotal(
 IN onumber INT,
 IN taxable BOOLEAN,
 OUT ototal DECIMAL(8,2)
)
BEGIN
 DECLARE total DECIMAL(8,2);
 DECLARE taxrate INT DEFAULT 6;
 
 SELECT SUM(item_price * quantity)
 FROM orderitems
 WHERE order_num = onumber
 INTO total;
 
 IF taxable THEN
	SELECT total + (total/100*taxrate) into total;
 END IF;
 
 SELECT total into ototal;
END;

CALL ordertotal(20005,1,@ototal);
SELECT @ototal;

-- 23.8 删除存储过程
DROP PROCEDURE IF EXISTS ordertotal;

第24章使用游标(未完成)

第25章使用触发器(未完成)

第26章管理事务处理

SHOW COLUMNS FROM orders;
SHOW COLUMNS FROM orderitems;
-- START TRANSACTION、ROLLBACK、COMMIT 关键字
-- 26.1 事务回滚:START TRANSACTION -- ROLLBACK 之间的SQL语句修改都不生效
-- 能够回滚 INSERT, UPDATE, DELETE语句,但是不能够回滚 SELECT, DROP,CREATE语句
SELECT * FROM customeremaillist;
START TRANSACTION;
DROP VIEW IF EXISTS customeremaillist; 
SELECT * FROM customeremaillist;
ROLLBACK;
SELECT * FROM customeremaillist;

SELECT * FROM orderitems;
START TRANSACTION;
DELETE FROM orderitems;
SELECT * FROM orderitems;
ROLLBACK;
SELECT * FROM orderitems;

-- 26.2 事务提交
START TRANSACTION;
DELETE FROM orderitems WHERE order_num = 20010;
DELETE FROM orders WHERE order_num = 20010;
COMMIT;

-- 26.3 打开关闭自动提交 0-假,1-真(默认为真)
SET autocommit=1; -- 关闭自动提交

-- 26.4 完成新增订单整个流程

第27章全球化和本地化(未完成)

第28章安全管理(未完成)

访问控制的场景:

  • 多数用户只需要读写,少量用户需要创建删除
  • 部分用户只需要拥有读权限
  • 某些用户需要拥有处理其他账户的权限
  • 用户只需要访问存储过程,不需要访问数据

root 用户为超级管理员,日常操作不应该使用root用户

user表用来管理当前用户

第29章数据库维护(未完成)

第30章改善性能(未完成)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值