创建视图:
create view myviewname(MemberNameEmail) as
select lastname, firstname,email,dateofjoining
from memberdetails;
创建试图后可以用一句select语句来使用它
select * from MemberNameEmail
**************************************
事务:原子性 一致性 隔离性 持久性
关键字:commit 表示已经写入磁盘不可回滚
rollback 回滚,commit之前的内容不可回滚
start transaction 开始一个事务 (mysql) 回滚整个事务
begin transaction 。。。commit transaction (sql server)事务开始结束
保留点(占位符) mysql 用savepoint delete1; rollback to delete1;回滚到delete1
sql server 用save transaction delete1; rollback transaction delete1;
*******************************************
存储过程:
create procedure test_data(rows int)
begin
declare val1 float;
declare val2 float;
repeat
select rand() into val1;
select rand() into val2;
insert into tdata values(null,val1,val2);
set rows=rows-1;
until rows=0
end repeat;
end//
call test_data;
select * from tdata //
*****************************
外键:
create table orders(
order_num integer not null primary key,
order_date datetime not null,
cust_id char(10) not null references customers(cust_id)
);
alter table customers
add constraint
forign key (cust_id) references customers (cust_id)
********************************************************
触发器:
delimiter //
create trigger ad_delete_manufacturer_all
after delete on country
for each row
begin
delete from manfacturer where countryid=old.countyid;
end;//
delimiter //
create tigger ad_delete_product_all
after delete on manufacturer
for each row
begin
delete from product where manufacturerid=old.manufacturerid;
end;//
分享到:
相关推荐
数据库基本知识,数据库系统的基本概念,关系数据库,Visual FoxPro 系统概述
数据库基本知识(自己整理,初学者可以看一下,基于某MySql).docx数据库基本知识(自己整理,初学者可以看一下,基于某MySql).docx数据库基本知识(自己整理,初学者可以看一下,基于某MySql).docx数据库基本知识(自己整理,...
数据库基本知识培训.ppt 数据库基本知识培训.ppt 数据库基本知识培训.ppt
sql 2005 数据库基本知识,学习考试用资料哦
SQL数据库基本知识,属于入门级。包含多个文件。
数据库基本知识 2.1.1 计算机系统组成与应用领域 2.1.2 计算机的应用领域 第3章 数据结构与算法 3.1.1 数据结构的基本概念 3.1.2 主要的数据存储方式 第4章 操作系统 4.1.1 操作系统概述 4.1.2 操作...
此文是我精心收集的,关于数据库的基本知识,面对初学者。对于初学者了解数据库应该会有所帮助。
数据库基本知识与应用考试大纲.docx数据库基本知识与应用考试大纲.docx数据库基本知识与应用考试大纲.docx数据库基本知识与应用考试大纲.docx数据库基本知识与应用考试大纲.docx数据库基本知识与应用考试大纲.docx...
数据库基本知识与应用考试大纲.pdf数据库基本知识与应用考试大纲.pdf数据库基本知识与应用考试大纲.pdf数据库基本知识与应用考试大纲.pdf数据库基本知识与应用考试大纲.pdf数据库基本知识与应用考试大纲.pdf数据库...
FOXPRO数据库基本知识
2023年数据库基本知识VisualFoxpro数据库程序设计教案章.doc
三级数据库基本知识点.pdf
【推选】数据库基本知识PPT资料.ppt
Sytem ,简称 DBS ) :数据库系统是指在计算机系统中引入数据库后的系统构成,一般由数据库、数据库管理系统(及其开发工具)、应用系统、数据库管理员构成。解析数据库系统和数据库是两个概念。数据库系统是一个人...
数据库基本知识以及操作脑图
数据库基本知识与Visual
数据库基本知识,英文版式,那老师会骂死我的,呵呵
数据库基本知识综述.pptx