Dat
Dat
Dat
use library_managment;
/* table */
/*drop table CATEGORY_DETAILS*/
checkpoint;
select Borrower_Details.Borrower_id,Book_Details.Book_title
from Borrower_Details,Book_Details
where Borrower_Details.book_id=Book_Details.ISBN_Code
use library_managment
select student.student_id, student.student_name, book.Book_Title,
staff.staff_name, b.Borrowed_To
from student_Details student, Staff_Details staff, Borrower_Details b,
book_details book
where book.ISBN_Code = b.book_id and b.Issued_by = staff.Staff_id;
select*from Shelf_Details;
--creating view
-- Create login
-- Create roles
-- Create users for each customer and assign them to the respective roles
BEGIN TRANSACTION;
-- Rollback to SavePoint1
ROLLBACK TRANSACTION SavePoint1;
COMMIT TRANSACTION;
-- Full Backup
backup database library_managment
to disk = 'C:\Backup\library_managment_full.bak'
with noinit
-- Differential Backup
backup database library_managment
to disk = 'C:\Backup\library_managment_diff.bak'
with differential
-- Encrypt a column
UPDATE STAFF_DETAILS
SET Password = EncryptByKey(Key_GUID('staffkey'), Password);
-- Decrypt a column
SELECT Password,
CONVERT(int, DecryptByKey(Password)) AS Password
FROM STAFF_DETAILS;
--Enabling encription
/*
-- Encrypt a column
UPDATE Customer
SET Email = EncryptByKey(Key_GUID('CustomerKey'), Email);
-- Decrypt a column
SELECT CustomerID,
CONVERT(VARCHAR(100), DecryptByKey(Email)) AS Email
FROM Customer;
-- Close the symmetric key
CLOSE SYMMETRIC KEY CustomerKey;
/*
-- commited transactions
begin transaction;
UPDATE Book_Details set Shelf_Id = 1
where ISBN_CODE = 2;
commit;
rollback;
-- uncommited transactions
begin transaction;
UPDATE Book_Details set Shelf_Id = 2
where ISBN_CODE = 6;
rollback;
-- create trigger
create trigger trigger_1 on database for drop_table
as print"you cann't drop table"
rollback;