MYSQL数据库专项温习

1 关系数据库分类

关系->以二维表格模式组织数据关系(excel表格)
ORACLE
DB2
SQLserver
MYSQL

2 SQL定义

sql->结构化查询语言 structured query language
sql是在数据库上执行一系列数据操作的规范语言

3.MySQL 的登录与退出?

1)MySQL登录(登入本机电脑中数据库)

mysql -u root -p
其中:
a) mysql 指令为一个mysql的客户端程序b) -u 示意用户选项c) -p 示意明码选项
2)MySQL 退出
a)quit
b)exit

4.MySQL 根本指令的利用

1)status 查看以后数据库系统的状态信息
2)show databases;查看以后用户下的数据库3)select user(); 查看以后登录用户(在mysql中没有dual伪表)
4)select now(); 查看以后日期工夫
5)? functions (?示意帮忙,functions 示意函数)

这里的?等价于help ,例如 ? show 等价于help show.

练习:本人查问concat 函数的利用.

5.MySQL 中根本SQL的利用?

1 数据库相干SQL语句

a)显示以后用户下的数据库 show databases;
b)创立数据库(语法参考 ? create database)
  create database 库名;
  create database pms;
  create database if not exists pms;
  create database if not exists pms character set utf8; 要是打一半想勾销 能够应用 c来勾销 阐明:在mysql中一个用户下能够有很多数据库(DB)

  mysql> show create database pms;
  +----------+----------------------------------------------------------------+
  | Database | Create Database                                               |
  +----------+----------------------------------------------------------------+
  | pms     | CREATE DATABASE pms /!40100 DEFAULT CHARACTER SET latin1 / |
  +----------+----------------------------------------------------------------+
  1 row in set (0.01 sec)

c)应用或关上数据库 use 库名;
  use database; 查看以后正在应用的数据库: select database();

d)删除数据库(语法参考 ? drop database)
  drop database 库名;
  drop database pms;
  drop database if exists pms;
e)查看表 show tables;

2.MySQL 中表的相干操作

a)创立表(语法 ? create table )

  create table user(
  username varchar(20),
  password varchar(30),
  email varchar(30),
  mobile varchar(20)
  );
创立带有主键的表 -- primary key 是申明该字段为主键,数据库会查看其唯一性 -- auto_increment 是要求数据库主动生成主键的值 create table if not exists pet(
      id int primary key auto_increment,
      name varchar(100) not null
  );当须要理解具体类型时能够: ? 具体数据类型 例如 ? int当须要查看某张表的创立语句时,能够应用 show create table pet
当须要显示表构造时能够应用:
  desc 表名;
  desc pet

b)批改表(语法? alter table ):追加字段(列)
  alter table user add sex char(1),add address varchar(100);
c)删除表(语法 ? drop table)
  drop table 表名;
  drop table if exists pet;
c)

3.MySQL 中表中数据的操作(减少、批改、删除、查问数据)

DML语言只蕴含 增 删 改 DQL语言蕴含 查问
a)向表中写入数据(insert) 全列插入,示意给所有字段赋值,按建表时的程序赋值 insert into user values('wukong','123','wukong@qq.com',null,'M','花果山'); 局部列插入 insert into pet(id,name) values (null,'B');
  insert into pet(name)values('C');


b) 更新表中数据(语法参考? update)
-- 批改用户update user set email='ts@qq.com',mobile='110' where username='tangseng';
c) 删除表中数据(语法参考? delete)
-- 删除用户
delete from user where username='tangseng';
delete from user where mobile is null;
留神 若没有where条件 则全副数据都会被删除!!!

DELETE 删除表中的数据,表构造还在;删除后的数据能够找回TRUNCATE 删除是把表间接DROP掉,而后再创立一个同样的新表。
删除的数据不能找回。执行速度比DELETE快。


d)查问表中数据(select)
  select * from pet;
  select id,name from pet;

  select id,name
  from pet
  where id=10;
----在显示时给字段取别名 select username as '用户名',password as '明码' from user;
  select username as NAME,password as PWD from user;
-- 在查问时减少筛选条件 select * from user where sex='M';
  select * from user where sex='M' and username='bajie';
  select * from user where email is null;
  select * from user where email is not null;

6.SQL分类

1)DDL Data Definition Language
  - 数据结构定义语言 - 用来定义数据库对象:库、表、列等; - 蕴含:create,alter,drop语句 - 重点面试题 留神DDL不反对事务 即DDL操作后无奈回滚 - 举例见 2.MySQL 中表的相干操作
  2)DML Data Manipulation Language
  - 数据更改语言 - 蕴含:insert,update,delete
  - 重点面试题 留神DML反对事务 即在非主动提交模式下 操作后能够回滚 - 举例见 3.MySQL 中表中数据的操作(减少、批改、删除、查问数据)
  3)DQL Data Query Language
  - 数据查询语言 - 蕴含:select
  - 举例见 3.MySQL 中表中数据的操作(减少、批改、删除、查问数据) 8.MySQL数据库DQL数据查询语言(特地重要)
  4)TCL Transaction Control Language
  - 事务管制语言 - 蕴含:commit,rollback,savepoint保留点
  5)DCL Data Control Language
  - 数据库管制语言,用来治理数据库的权限 - 蕴含:grant受权 revoke 勾销受权

7.罕用数据类型

int:整型 double:浮点型,例如double(5,2)示意最多5位,其中必须有2位小数,即最大值为999.99; char:固定长度字符串类型; char(10)     'aaa     ' 占10位 varchar:可变长度字符串类型; varchar(10) 'aaa' 占3为 text:字符串类型; blob:字节类型; date:日期类型,格局为:yyyy-MM-dd; time:工夫类型,格局为:hh:mm:ss
  timestamp:工夫戳类型 yyyy-MM-dd hh:mm:ss 会主动赋值 datetime:日期工夫类型 yyyy-MM-dd hh:mm:ss

8.MySQL数据库DQL数据查询语言(特地重要)

数据库执行DQL语句不会对数据进行扭转,而是让数据库发送后果集给客户端。 查问返回的后果集是一张虚构表。

查问关键字:SELECT
语法: SELECT 列名 FROM 表名

1条件查问

条件查问就是在查问时给出WHERE子句,在WHERE子句中能够应用如下运算符及关键字:
=、!=、<>、<、<=、>、>=;
BETWEEN…AND;
IN(set);
IS NULL;
AND;
OR;
NOT;
-- like含糊查问,%是通配符代替一个或多个字符
select * from item where name like '%联想%';
-- and,or
select * from item where name like '%ThinkPad%' and detail like '%14%';
select * from item where name like '%联想%' or name like '%戴尔%';
-- >,<,>=,<=,!=,<>
select * from item where name like '%显示器%' and price<=1000;
select * from item where name like '%显示器%' and price<=1000 and price>=900;
select * from item where name like '%显示器%' and price!=1299;
select * from item where name like '%显示器%' and price<>1299;
-- between m and n
select * from item where price between 500 and 1000;
-- in,is,not
select * from item where category_id in (7,8,11,12);
select * from item where category_id=9 and image is not null;
select * from item where category_id=10 and name not like '%寒冷%';
select * from item where price not between 500 and 1000;
select * from item where category_id not in (7,8,11,12);

2.排序

-- order by 字段 asc/desc
-- order by放在where之后
-- asc是升序,desc降序
select * from item where name like '%联想%' order by price asc;
-- 省略排序形式时,默认为升序
select * from item where name like '%联想%' order by price;
-- 能够用多个字段同时排序
select * from item order by category_id desc,price asc

3.分页

-- limit begin,size
-- 写在order by之后
-- begin是当前页的起始行号(从0开始)
-- size是本页要显示的最大行数
select * from item order by price limit 10,10;

4.解决显示后果

-- 拼接字符串
select concat(name,' ',price,'元') as title,detail,stock from item;
-- 计算(+ - * / %)
select name,detail,price*stock as total from item;
-- 格式化日期
select name,price,date_format(upload_time,'%Y年%c月%d日 %H时%i分%s秒') from item;
-- 空值解决
select name,price,ifnull(image,'无') as image,ifnull(detail,'无') as detail from item;

5.聚合函数

-- sum:求和select sum(stock) as total_stock from item;
select category_id,sum(stock) as total_stock from item where category_id=7;
-- 共计时,附带id,name等细节数据是无意义的-- 应用其余的聚合函数进行统计时,也是这样的
select id,name,sum(stock) as total_stock from item;
-- avg:求平均值
select avg(price) as avg_price from item;
select category_id,avg(price) as total_price from item where category_id=7;
-- count:求返回数据的行数-- 括号内写要统计的列的名字
select count(*) from item;
select count(id) from item;
select count(name) from item;
select count(*) from item where name like '%联想%';
-- max/min:求最大值/最小值
select max(price) from item;
select min(price) from item where name like '%联想%';

特地留神 null值聚合函数个别都不计算

6分组统计

-- group by 字段select category_id,sum(stock) from item group by category_id;
select category_id,avg(price) from item group by category_id;
-- 数据库执行SQL的程序-- from -> where -> group -> select
-- 上面SQL有误,因为在where里用了聚合函数select category_id,sum(stock) from item where sum(stock)>1000 group by category_id;
-- 对分组数据进行筛选,应该在group by中写条件(having)
select category_id,sum(stock) from item group by category_id having sum(stock)>1000;

having与where的区别:
  1.having是在分组后对数据进行过滤.
  where是在分组前对数据进行过滤 2.having前面能够应用分组函数(统计函数)
    where前面不能够应用分组函数。 WHERE是对分组前记录的条件,如果某行记录没有满足WHERE子句的条件,那么这行记录不会加入分组;而HAVING是对分组后数据的束缚
-- 非统计的条件能够写在where或having内-- 能写在where内的条件就写在这里,效率高select category_id,sum(stock) from item where category_id>10 group by category_id;
select category_id,sum(stock) from item group by category_id having category_id>10;
-- 查问学生文具和打印机的均匀单价select category_id,avg(price) from item where category_id in (11,13) group by category_id;
-- 查问均匀单价小于100的商品分类select category_id,avg(price) from item group by category_id having avg(price)<100;
-- 分组后排序
select category_id,max(price) from item group by category_id order by category_id desc;
select category_id,sum(price*stock) from item group by category_id order by category_id;
select category_id,sum(price*stock) as s from item group by category_id order by s desc;

留神:凡和聚合函数同时呈现的列名,则肯定要写在group by 之后 例如 查问每个部门的部门编号以及每个部门的人数: SELECT deptno,COUNT(*)
  FROM emp
  GROUP BY deptno;

7子查问

-- 在用户表中筹备一些数据insert into user values(null,'zhuge','321',null,null,now());
insert into user values(null,'zilong','321',null,null,now());
insert into user values(null,'yide','321',null,null,now());
insert into user values(null,'yunchang','321',null,null,now());
insert into user values(null,'xuande','321',null,null,now());
insert into user values(null,'mengde','321',null,null,now());
insert into user values(null,'quede','321',null,null,now());

-- 查问所有有地址的用户的ID
select distinct user_id from address; --1,3,4
-- 查问所有有地址的用户的全副信息-- user.id = address.user_id
select * from user where id in (1,3,4);
select * from user where id in (select distinct user_id from address);
-- 查问所有有商品的分类信息select * from category where id in (select distinct category_id from item);
-- 也能够应用exist实现上述查问逻辑-- 子查问若存在数据,则外层查问返回与子查问匹配的数据-- 子查问若不存在数据,则外层查问返回空select from user where exists (select from address where user_id=user.id);
-- 应用exists实现"查问所有有商品的分类信息"
select * from category where exists (select id from item where category_id=category.id);
-- 查问出所有有地址的省份信息(in,exists)
select * from province where id in (select distinct province_id from address);
select from province where exists (select from address where province_id=province.id);
-- 查问所有用户,以及他们所对应的地址数量select user_id,count(*) from address group by user_id;
select ,(select count() from address where user_id=user.id) as amount from user;
-- 查问所有分类,以及他们所对应的商品的库存总数
select *,(select sum(stock) from item where category_id=category.id) as total from categor

8关联查问

-- 等值连贯:查问出A和B相匹配的数据select
  u.id,
  u.username,
  u.password,
  a.name,
  a.address
from user as u,address as a
where u.id=a.user_id;
-- 内连贯:其作用与等值连贯雷同
-- inner能够省略不写select
  u.id,
  u.username,
  u.password,
  a.name,
  a.address
from user as u
inner join address as a on u.id=a.user_id
where 1=1;
-- 左外连贯-- A left outer join B on 条件-- A left join B on 条件select
  u.id,
  u.username,
  a.name,
  a.address
from user u
left join address a on u.id=a.user_id;
-- 右外连贯-- A right outer join B on 条件-- A right join B on 条件
select
  u.id,
  u.username,
  a.name,
  a.address
from user u
right join address a on u.id=a.user_id;

特地留神:笛卡尔积常常露面试题
当两表关联时,若没有写关联条件,则返回的总条目数是两表条目数的乘积,这个乘积就叫做笛卡尔积

9.自关联

-- 查问所有的分类,以及他们的父分类
select
  c.id as cid,
  c.name as cname,
  p.id as pid,
  p.name as pname
from category c
left join category p on c.parent_id=p.id;

-- 1.查问出所有的二级分类,以及他们的父分类-- 查问一级分类:父亲为空的分类.
select id from category where parent_id is null;
-- 查问二级分类:父亲是一级分类.
select * from category
where parent_id in(
  select id from category where parent_id is null
);
-- 查问二级分类,以及他们的父亲.
select
  c.id cid,c.name cname,p.id pid,p.name pname
from category c
left join category p on c.parent_id=p.id
where c.parent_id in(
  select id from category where parent_id is null
);
-- 2.查问出所有的三级分类,以及他们的父分类select
  c.id cid,c.name cname,p.id pid,p.name pname
from category c
left join category p on c.parent_id=p.id
where c.id in (select category_id from item);

-- 父亲为空的分类是一级分类
-- pid为空的分类是一级分类select * from category where parent_id is null;
-- 爷爷为空的分类就是二级分类-- 父亲的pid为空的分类是二级分类
-- c-孩子;p-父亲;p.parent_id-爷爷;
select *
from category c
inner join category p on c.parent_id=p.id
where p.parent_id is null;
-- 太爷爷为空的分类分类是三级分类-- 爷爷的pid为空的分类是三级分类
-- c:孩子;p:父亲;g:爷爷;g.parent_id:太爷爷;
select
  c.id cid,c.name cname,
  p.id pid,p.name pname,
  g.id gid,g.name gname
from category c
inner join category p on c.parent_id=p.id
inner join category g on p.parent_id=g.id
where g.parent_id is null;

9.索引

-- 在没有创立索引的状况下,查问数据
-- 1.0x秒select * from item2 where title='100';

-- 创立索引-- create index 索引名 on 表名(字段,字段,字段,...)
create index index_of_item2 on item2(title(10),selling_point(10),price);

-- 在创立索引的状况下,再次查问数据
-- 0.0x秒select * from item2 where title='100';

-- 删除索引drop index 索引名 on 表名;

10.束缚

数据库束缚是为了保证数据的完整性(正确性)而实现的一套机制
1、主键束缚(PK)primary key constraint 惟一且不为空
alter table Student  
add constraint PK_Student primary key(sId)
其中constraint 示意束缚,PK_Student为束缚名,primary key(sId)指定为哪一列增加主键束缚,其中的sId示意增加束缚的字段。
2、惟一束缚(UQ)unique constraint惟一,容许为空,即能够再其中呈现null值,但只能呈现一次
alter table Student  
add constraint UQ_Student_sNo unique(sNo)  
unique(sNo)中的sNo示意增加unique束缚的字段名
3、默认束缚(DF)default constraint默认值
alter table Student  
add constraint DF_Student_sSex default('男') for sSex 为student表中的sSex字段设置默认值为‘男’,即当该字段为填入数据时,数据库将自行为其加上数据内容为‘男’的数据
其中DF_Student_sSex为默认束缚名
注:以上创立的主键束缚、惟一束缚均存在与数据库的‘ 键’目录下,而默认束缚在位于‘束缚’目录下

4、查看束缚(CK)check constraint范畴以及格局限度
alter table Student  
add constraint CK_Student_sSex check (sSex='男' or sSex='女') 为student表中的sSex字段增加内容查看束缚,只容许增加的内容为‘男’或者是‘女’
5、非空束缚(NN) not null
create table student(id int primary key auto_increment,age int not null);
6、外键束缚(FK)foreign key constraint表关系alter table student  
add constraint FK_Student_sClassId foreign key (sClassId) references Class(cId) 删除主表中数据的时候,必须先删除子表中对应的数据,否则执行SQL语句时,数据库报错
提到外键,不得不提的是级联删除以及级联批改
alter table Student  
add constraint FK_Student_sClassId foreign key (sClassId) references Class(cId)  
--级联删除 on delete cascade  
--级联批改 on update cascade 即当删除主表中的数据时,子表中与其无关的数据都将被删除。因而,此外键的创立办法在应用时需谨慎思考

删除束缚

alter table Student  
drop constraint CK_Student_sAge


-- 1)创立订单表,不加任何束缚
create table orders(
  id bigint,
  user_id int,
  item_id int,
  item_name varchar(100),
  item_price decimal(11,4),
  item_detail varchar(200),
  item_image varchar(200),
  create_time timestamp
);

-- 2)插入空数据
insert into orders values(null,null,null,null,null,null,null,null);

-- 3)重建订单表,减少非空束缚
drop table orders;
create table orders(
  id bigint not null,
  user_id int not null,
  item_id int not null,
  item_name varchar(100),
  item_price decimal(11,4),
  item_detail varchar(200),
  item_image varchar(200),
  create_time timestamp
);

-- 4)再次插入空数据
insert into orders values(null,null,null,null,null,null,null,null);

-- 5)插入非空数据
insert into orders values(1,1,2,null,null,null,null,null);

-- 6)插入ID雷同的数据
insert into orders values(1,1,2,null,null,null,null,null);

-- 7)重建订单表,减少唯一性束缚
drop table orders;
create table orders(
  id bigint not null unique,
  user_id int not null,
  item_id int not null,
  item_name varchar(100),
  item_price decimal(11,4),
  item_detail varchar(200),
  item_image varchar(200),
  create_time timestamp
);

-- 8)插入ID雷同的2条数据
insert into orders values(1,1,2,null,null,null,null,null);
insert into orders values(1,1,2,null,null,null,null,null);

-- 9)重建订单表,减少主键束缚
drop table orders;
create table orders(
  id bigint primary key,
  user_id int not null,
  item_id int not null,
  item_name varchar(100),
  item_price decimal(11,4),
  item_detail varchar(200),
  item_image varchar(200),
  create_time timestamp
);

-- 10)减少ID为空的数据,减少ID反复的数据
insert into orders values(null,1,2,null,null,null,null,null);
insert into orders values(1,1,2,null,null,null,null,null);
insert into orders values(1,1,2,null,null,null,null,null);

-- 11)减少一个订单数据,用户ID乱写
insert into orders values(2,100,2,null,null,null,null,null);

-- 12)重建订单表,减少外键束缚
drop table orders;
create table orders(
  id bigint primary key,
  user_id int not null,
  item_id int not null,
  item_name varchar(100),
  item_price decimal(11,4),
  item_detail varchar(200),
  item_image varchar(200),
  create_time timestamp,
  CONSTRAINT fk_user_id foreign key(user_id) REFERENCES user(id)
);

-- 13)减少一个订单数据,用户ID乱写
insert into orders values(2,100,2,null,null,null,null,null);

-- 14)给地址表追加外键束缚
alter table address add CONSTRAINT fk_user_id2 foreign key (user_id) REFERENCES user(id);

-- 15)给地址表减少用户ID谬误的数据
insert into address values(null,100,'唐僧',null,null,null,null,null,null,null,null,null,null);

-- 16)重建订单表,减少默认束缚
drop table orders;
create table orders(
  id bigint primary key,
  user_id int not null,
  item_id int not null,
  item_name varchar(100),
  item_price decimal(11,4) default 9,
  item_detail varchar(200),
  item_image varchar(200),
  create_time timestamp
);

-- 17)减少单价为空的订单数据
insert into orders(id,user_id,item_id) values(1,1,1);

11.事务

1)什么是事务(特地留神 常露面试题)

· 满足如下规定的数据库拜访叫事务

· 原子性:事务是一个残缺的过程,要么都胜利,要么都失败.

· 一致性:事务前后的数据要统一,即收支平衡.

· 隔离性:事务过程中的数据不能被拜访.

· 持久性:事务一旦达成,就永恒无效.

· 数据库都反对事务,都实现了上述4点.

2)小例子

-- 假如这里也执行过DML语句insert ...;
update ...;
delete ...;
-- 敞开主动提交事务set autocommit=0;
-- 开始事务start transaction;
-- 执行DML语句insert into user values(null,'wukong','123',null,null,null);
-- 查问这条数据select * from user;
-- commit/rollback
-- 回滚到开始事务那里
rollback;

12数据库补充知识点(鄙视必考)

1 程序问题

查问语句书写程序:select – from- where- groupby- having- order by -limit
查问语句执行程序:from - where -group by -having - select - order by -limit

2 数据库设计常见三大范式

为了建设冗余较小、结构合理的数据库,设计数据库时必须遵循肯定的规定。在关系型数据库中这种规定就称为范式。
范式是合乎某一种设计要求的总结。要想设计一个结构合理的关系型数据库,必须满足肯定的范式。
在理论开发中最为常见的设计范式有三个:
1.第一范式(确保每列放弃原子性,所有字段值都不可合成)
2.第二范式(确保表中的每列都和主键相干而不能只与主键的某一部分相干(次要针对联结主键而言))
3.第三范式(确保每列都和主键列间接相干,而不是间接相干)


1.第一范式(确保每列放弃原子性)
第一范式是最根本的范式。如果数据库表中的所有字段值都是不可合成的原子值,就阐明该数据库表满足了第一范式。

第一范式的正当遵循须要依据零碎的理论需要来定。比方某些数据库系统中须要用到“地址”这个属性,原本间接将
“地址”属性设计成一个数据库表的字段就行。然而如果零碎常常会拜访“地址”属性中的“城市”局部,那么就非要将
“地址”这个属性从新拆分为省份、城市、具体地址等多个局部进行存储,这样在对地址中某一部分操作的时候将非
常不便。这样设计才算满足了数据库的第一范式。这样在对用户应用城市进行分类的时候就十分不便,也进步了数
据库的性能。

2.第二范式(确保表中的每列都和主键相干)
第二范式在第一范式的根底之上更进一层。第二范式须要确保数据库表中的每一列都和主键相干,而不能只与主键
的某一部分相干(次要针对联结主键而言)。也就是说在一个数据库表中,一个表中只能保留一种数据,不能够把
多种数据保留在同一张数据库表中。

比方要设计一个订单信息表,因为订单中可能会有多种商品,所以要将订单编号和商品编号作为数据库表的联结主键,
如下表所示。

这样就产生一个问题:这个表中是以订单编号和商品编号作为联结主键。这样在该表中商品名称、单位、商品价格等
信息不与该表的主键相干,而仅仅是与商品编号相干。所以在这里违反了第二范式的设计准则。而如果把这个订单信
息表进行拆分,把商品信息拆散到另一个表中,把订单项目表也拆散到另一个表中,就十分完满了。如下所示。

这样设计,在很大水平上减小了数据库的冗余。如果要获取订单的商品信息,应用商品编号到商品信息表中查问即可。

3.第三范式(确保每列都和主键列间接相干,而不是间接相干)

第三范式须要确保数据表中的每一列数据都和主键间接相干,而不能间接相干。

比方在设计一个订单数据表的时候,能够将客户编号作为一个外键和订单表建设相应的关系。而不能够在订单表中
增加对于客户其它信息(比方姓名、所属公司等)的字段。如上面这两个表所示的设计就是一个满足第三范式的数据库表。

这样在查问订单信息的时候,就能够应用客户编号来援用客户信息表中的记录,也不用在订单信息表中屡次输出客
户信息的内容,减小了数据冗余。

3 数据库常见对象

数据库对象是数据库的组成部分,常见的有以下几种:
1.表(Table )
数据库中的表与咱们日常生活中应用的表格相似,它也是由行(Row) 和列(Column)组成的。列由同类的信息组成,
每列又称为一个字段,每列的题目称为字段名。行包含了若干列信息项。一行数据称为一个或一条记录,它表白有肯定
意义的信息组合。一个数据库表由一条或多条记录组成,没有记录的表称为空表。每个表中通常都有一个主关键字,用
于惟一地确定一条记录。
2.索引(Index)
索引是依据指定的数据库表列建设起来的程序。它提供了快速访问数据的路径,并且可监督表的数据,使其索引所指向
的列中的数据不反复。
3.视图(View)
视图看上去同表仿佛截然不同,具备一组命名的字段和数据项,但它其实是一个虚构的表,在数据库中并不理论存。在
视图是由查询数据库表产生的,它限度了用户能看到和批改的数据。由此可见,视图能够用来管制用户对数据的拜访,
并能简化数据的显示,即通过视图只显示那些须要的数据信息。
4.图表(Diagram)
图表其实就是数据库表之间的关系示意图。利用它能够编辑表与表之间的关系。
5.缺省值(Default)
缺省值是当在表中创立列或插入数据时,对没有指定其具体值的列或列数据项赋予当时设定好的值。
6.规定(Rule)
规定是对数据库表中数据信息的限度。它限定的是表的列。
7.触发器(Trigger)
触发器是一个用户定义的SQL事务命令的汇合。当对一个表进行插入、更改、删除时,这组命令就会主动执行。
8.存储过程(Stored Procedure)
存储过程是为实现特定的性能而会集在一起的一组SQL 程序语句,经编译后存储在数据库中的SQL 程序。
9.用户(User)
所谓用户就是有权限拜访数据库的人。