当前位置:网站首页>[Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter 7 exercises]
[Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter 7 exercises]
2022-07-03 13:04:00 【Laughing cold faced ghost】
List of articles
One 、 choice question
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|
B | C | B | D | A |
1. stay SQL Server What is not an object in is ( ).
A) user
B) data
C) surface
D) data type
2. Variable declared :DECLARE @i int,@c char(4), For now @i assignment 10, by @c assignment ’abcd’, Correct language
The sentence is ( ).
A)SET @i=10, @c=‘abcd’
B)SET @i=10, SET @c=‘abcd’
C)SELECT @i=10, @c=‘abcd’
D)SELECT @i=10, SELECT @c=‘abcd’
3. stay SQL Server Server , A stored procedure is a set of predefined and ( ) Of Transact-SQL sentence .
A) preservation
B) compile
C) explain
D) To write
4. It can be used ( ) To declare a cursor .
A)CREATE CURSOR
B)ALTER CURSOR
C)SET CURSOR
D)DECLARE CURSOR
5. When the 【】 The positions are BREAK,CONTINUE or RETURN when , The output value is ( ).
DECLARE @n int
SET @n=3
WHILE @n>0
BEGIN
SET @n=@n-1
IF @n=1 []
END
PRINT @n
A)1,0, No output
B)1,1,_
C)0,0,0
D)0,1,2
Two 、 Completion
1.Transact-SQL Can be used in local variable and Global variables Two variables .
2. stay Transact-SQL Two types of annotators can be used in : Single-line comments - - And multiline comments /… …/.
3. The command used to declare one or more local variables is DECLARE.
4. Whether stored procedures or triggers , All are SQL Statement and Process control Collection of statements .
5.SQL Server 2012 Support DML trigger 、DDL trigger and Login trigger There are three types of triggers .( For reference only )
6. Each trigger has Insert table and Delete table Two special tables are in the database .
7. stay SQL Server 2012 There is Database backup 、 Transaction log backup 、 Differential backup and File and filegroup backup Four types of backup .
8. stay SQL Server 2012 There is Simple reduction 、 complete reduction and Batch log restore Three database restore modes .
9. The backup device can be Hard disk 、 Magnetic tape or The Conduit .
3、 ... and 、 Short answer
1. What is trigger ? What are the functions of triggers ?
Trigger is a special stored procedure , It contains a series of T-SQL sentence , But its execution is not with EXECUTE The command explicitly calls , It is automatically activated and executed when certain conditions are met , Such as inserting records into the table ﹑ It is automatically activated and executed by the system when updating records or deleting records .
Using triggers has the following advantages :
(1) Triggers are automatically activated and executed when an event occurs . Such as , After an object is defined in the database , Or it will be activated and automatically executed immediately after making some modifications to the data in the table .
(2) Triggers can achieve more complex integrity requirements than constraints , such as CHECK Columns in other tables cannot be referenced in constraints , Triggers can reference ;CHECK Constraints are just conditional expressions connected by logical symbols , Unable to complete complex logical judgment function .
(3) The trigger can modify the status before and after according to the table data , Take corresponding measures according to their differences .
(4) Triggers can prevent malicious or erroneous INSERT、UPDATE and DELETE operation .
2. Brief description SQL Server 2012 Data backup in 4 Types .
(1) Full database backup
Full database backup (Database Backup) It refers to backing up all objects in the database , Including transaction logs .
This backup type requires relatively large storage space to store backup files , The backup time is also long , When restoring data , Just restore a backup file .(2) Differential backup
Database differential backup (Differential Database Backup) It's a complement to a full backup , Only back up the database since the last time
After a full backup ( Be careful : Not after the last differential backup ) Part of the database changes . Compared with full backup , The data volume of differential backup is smaller than that of full backup , Backups are also faster than full backups . therefore , Differential backup is usually used as a common backup method .(3) Transaction log backup .
Transaction log backup (Transaction Log Backup) Only the transaction log contents of the database are backed up . Transaction log backup takes transaction log files as backup objects , It is equivalent to recording every operation in the database .
The transaction log records the database changes in a certain period of time , So before doing a transaction log backup , Must enter
Row full backup . Similar to differential backup , Transaction log backups produce smaller files 、 Short occupation time , But when restoring data ,(4) File and filegroup backup
File and filegroup backup is to backup a single database file or filegroup , Its advantage is convenience and flexibility ,
And when restoring, you can restore only the damaged database files .
3.SQL Server What methods are provided to reduce the execution time of backup or restore operations .
- (1) Use multiple backup devices to perform backup processing at the same time . Empathy , You can restore databases from multiple backup devices at the same time .
- (2) Comprehensive use of database full backup 、 Differential backup or transaction log backup to reduce the amount of data that needs to be backed up each time .
- (3) Use file or filegroup backups and transaction log backups , In this way, only those files containing relevant data can be backed up or restored , Not the entire database .
PS: For reference only , Because of limited personal ability , If there is a mistake , Please grant me your advice ~
Reference
边栏推荐
- The upward and downward transformation of polymorphism
- studio All flavors must now belong to a named flavor dimension. Learn more
- Quickly learn member inner classes and local inner classes
- An example of newtonjason
- 并网-低电压穿越与孤岛并存分析
- 【数据库原理及应用教程(第4版|微课版)陈志泊】【第四章习题】
- [combinatorics] permutation and combination (multiple set permutation | multiple set full permutation | multiple set incomplete permutation all elements have a repetition greater than the permutation
- Xctf mobile--app1 problem solving
- Gan totem column bridgeless boost PFC (single phase) seven PFC duty cycle feedforward
- Analysis of a music player Login Protocol
猜你喜欢
Sitescms v3.1.0 release, launch wechat applet
Seven habits of highly effective people
【数据挖掘复习题】
剑指 Offer 12. 矩阵中的路径
Quick learning 1.8 front and rear interfaces
Method overloading and rewriting
Huffman coding experiment report
Sword finger offer 12 Path in matrix
Social community forum app ultra-high appearance UI interface
Node.js: express + MySQL的使用
随机推荐
我的创作纪念日:五周年
Simple use and precautions of kotlin's array array and set list
CVPR 2022 图像恢复论文
剑指 Offer 14- II. 剪绳子 II
C graphical tutorial (Fourth Edition)_ Chapter 20 asynchronous programming: examples - cases without asynchronous
Xctf mobile--rememberother problem solving
【数据库原理及应用教程(第4版|微课版)陈志泊】【第五章习题】
剑指 Offer 16. 数值的整数次方
Solve system has not been booted with SYSTEMd as init system (PID 1) Can‘t operate.
OpenHarmony应用开发之ETS开发方式中的Image组件
Node.js: express + MySQL的使用
Grid connection - Analysis of low voltage ride through and island coexistence
Huffman coding experiment report
Kotlin - 改良装饰者模式
[problem exploration and solution of one or more filters or listeners failing to start]
解决 System has not been booted with systemd as init system (PID 1). Can‘t operate.
Analysis of a music player Login Protocol
Everything comes to him who waits
Ali & ant self developed IDE
C graphical tutorial (Fourth Edition)_ Chapter 13 entrustment: what is entrustment? P238