DataBase#1 SQL Final Revision
DataBase#1 SQL Final Revision
Title varchar(50) ,
Author Varchar(50),
Publisher Varchar(50),
Year date,
Shelf Varchar(50),
Primary key(book#)
);
Page | 1
Create Table Loan (
ON Update Cascade
ON delete Cascade ,
Foreign key (book#) References Book (book#)
ON Update Cascade
ON delete Cascade
);
b) Consider the following relational structure of a COMPANYdatabase:
EMPLOYEE ( ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
PROJECT (PNO, PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
Write the SQL statements (DDL) for the following:
Page | 2
2) Create the PROJECT and WORKS-ON tables.
Include thePrimary/Foreign key constraints.
ON Update Cascade
ON delete Cascade,
);
Page | 3
Create Table WORKS_ON (
ENO int Not NUll,
HOURS decimal,
Primary Key (ENO, PNO),
Foreign Key (ENO) REFERENCES Empoloyee (ENO)
ON Update Cascad
ON delete Cascade ,
ON Update Cascade
ON delete Cascade ,
);
Consider the relational structure of the sales / order database:
Customer(CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 4
3) Create the ORDERPRODUCT table, Include the Primary /Foreign
key constraints
Create Table Orderproducts (
QTY_Ordered VarChar(50) ,
PRIMARY KEY (order#, Product#),
FOREIGN KEY (order#) REFERENCES orders(order#)
ON Update Cascade
ON delete Cascade ,
FOREIGN KEY (product#) REFERENCES Products(Product#)
ON Update Cascade
ON delete Cascade
);
Consider the following relational structure of Educationaldatabase:
• Department (dno, dname, manager)
• Student (stud#, sname, city, birthday, dno)
• Course (course#, cname, dno, credit_hours)
• Enrollment (stud#, course#, year, semester, score)
Page | 5
4) Create the Student table. Include thePrimary/Foreignkey constraints
sname VARCHAR(50),
city VARCHAR(50),
birthday DATE,
dno VarChar(50) Not NUll,
Primary Key (Stud#) ,
FOREIGN KEY (dno) REFERENCES Departments(dno)
ON Update Cascade
ON delete Cascade
);
Page | 6
5) Create the Enrollment table. Include thePrimary/Foreign key
constraints
Create Table Enrollment (
stud# varchar(50) Not Null,
Course# varchar(50) Not Null,
year date,
semester varchar(20),
score varchar(100),
PRIMARY KEY (stud#, Course#),
FOREIGN KEY (stud#) REFERENCES Student(stud#)
ON Update cascade
ON delete cascade,
FOREIGN KEY (Course#) REFERENCES Course(Course#)
ON Update cascade
ON delete cascade,
);
Page | 7
6)Create the ORDER table. Include the Primary/Foreign key
constraints.
DATE date,
TOTAL-VALUE varchar(50),
Primarykey (order#),
FOREIGN KEY (CUSTOMER#) REFERENCES CUSTOMER (CUSTOMER#)
ON Update Cascade
ON delete Cascade
);
Page | 8
Alter Table:
a) Consider the following relational structure of a library loandatabase:
Book ( book# , Title, Author, Publisher, Year, Shelf)
Page | 9
b) Consider the following relational structure of a COMPANYdatabase:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 10
b) Consider the following relational structure of a COMPANYdatabase:
Department (dno, dname, manager)
Page | 11
Define a new constraint:
a) Consider the following relational structure of a library loandatabase:
Book ( book# , Title, Author, Publisher, Year, Shelf)
Borrower (borrower#, name , city, status)
Loan (borrower#, book#, date-due-back)
Reservation ( borrower# , book#, reservation-date)
Loan-Status (status, max-no-of books, max-loan-period)
Write the SQL statements (DDL) to achieve the following:
1) Define a new constraint valid-status in the Loan- statustable that status
legal values are staff, undergraduate, postgraduate, and visitor
Page | 12
2) Define a new constraint valid-budget that the BUDGET of aPROJECT is in the
range 15000 to 2500000
OR:
ALTER TABLE PROJECT
ADD CONSTRAINT valid-budget
CHECK (BUDGET >= 15000 AND BUDGET <= 2500000);
Page | 13
3) Define a new constraint valid_credit_limit that the CREDIT_LIMIT of a
CUSTOMER is in the range 3000 to 1200pound
Page | 14
Define the SQL view:
a) Consider the following relational structure of a library loandatabase:
Book ( book# , Title, Author, Publisher, Year, Shelf)Borrower
(borrower#, name , city, status)
Loan (borrower#, book#, date-due-back) Reservation ( borrower# ,
book#, reservation-date)
Loan-Status (status, max-no-of books, max-loan-period)
Write the SQL statements (DDL) to achieve the following:
1) Define the SQL view consisting of the borrower number forall borrowers
reserve more than 3 books.
Create View VW AS
SELECT borrower#
FROM Reservation
GROUP BY borrower#
FROM Works_on
GROUP BY eno
HAVING AVG (hours) < 12 ;
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
3)Define the SQL view consisting of the order number for all orders contain more
than 8 products
CREATE VIEW VW AS
SELECT order#
FROM orderproducts
GROUP BY order#
HAVING COUNT(*) > 8;
Page | 16
Consider the following relational structure of Educationaldatabase:
Department (dno, dname, manager)
3) Define the SQL view consisting of the course number for allcourses with total
enrollment greater than 20
CREATE VIEW VW AS
SELECT course#
FROM Enrollments GROUP BY course#
HAVING COUNT(*) > 20;
Page | 17
CREATE VIEW VW AS
SELECT ORDER#
FROM ORDERPRODUCT
GROUP BY ORDER#
HAVING AVG(QTY_ORDERED) > 500;
5) Define SQL View consisting of the student number for all studentswith total
enrolllment less than 3
CREATE VIEW VW AS
SELECT stud#
FROM Enrollment
GROUP BY stud#
HAVING COUNT(*) < 3;
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 19
8) Define SQL View consisting of the employee number for allempolyees
their total working hours more than 48 hours
CREATE VIEW VW AS
SELECT ENO
FROM WORKS-ON
GROUP BY ENO
HAVING SUM(HOURS) > 48;
Page | 20
Anything that starts with get, see where we will get what is required
from any table or tables
a) Consider the relational structure of Library database:
SELECT *
FROM Borrower
Page | 21
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
FROM EMPLOYEE
Page | 22
3) Get full details of all students of department number D3 instudent name
alphabetical order
SELECT *
FROM Students
4)Get full details of all courses belong department number D2in credit hours
descending order
SELECT *
FROM Course
WHERE dno = 'D2'
ORDER BY `credit-hours` DESC;
Page | 23
Consider the following relational structure of Educationaldatabase:
Department (dno, dname, manager)
Student (stud#, sname, city, birthday, dno)
Page | 24
1. Get the total number of books shelved on shelf Q14.
SELECT COUNT(*) As TotalBooks
FROM Book
WHERE [Link] = 'Q14';
b) Consider the Company database: Write the SQL statements(DML) for the
following:
FROM EMPLOYEE
WHERE DNO = 'D5';
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 25
Write the SQL statements for the following:
FROM Customers
WHERE credit_limit < 6000;
FROM Courses
WHERE dno = 'D1';
Page | 26
Consider the following relational structure of EducationalDatabase:
Department (dno, dname, headOfDepartment)
Page | 27
b) Consider the Company database: Write the SQL statements(DML) for the
following:
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
PROJECT (PNO, PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
7) Get the total number of empolyees Assigned in departmentnumber D2
SELECT COUNT(*) AS TotalEmployees
FROM EMPLOYEE
WHERE DNO = 'D2';
Page | 28
1. Get for each project the project number and the number ofemployees working
in the project
Page | 29
3) Get for each product the product number and its totalquantity ordered
in all orders
SELECT PRODUCT#, SUM(QTY_ORDERED)
FROM ORDERPRODUCT
GROUP BY PRODUCT#;
b) Consider the Company database: Write the SQL statements(DML) for the
following:
4) Get for each project the project number and its totalworking hours
SELECT PNO, SUM(HOURS)
FROM WORKS-ON
GROUP BY PNO;
Page | 30
Get with Join Tables:OR From one Table
a) Consider the relational structure of Library database:
SELECT [Link]
FROM Book JOIN Reservation
ON [Link]# = [Link]#
WHERE Reservation.reservation_date = '1/12/2021';
2. Get the borrower name and title of all lent books due toback on
7/12/2021.
SELECT [Link] , [Link]
FROM Book JOIN Loan
ON [Link]# = [Link]#
JOIN Borrower
ON [Link]# = [Link]#
WHERE Loan.date_due_back = '7/12/2021';
Page | 31
b) Consider the Company database: Write the SQL statements(DML) for the
following:
ON [Link] = Works_On.ENO
JOIN Project
ON Works_On.PNO = [Link]
JOIN Department
ON [Link] = [Link]
WHERE [Link] = 'production';
Page | 32
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
4) Get the name and address of all customers with credit limitmore than 6000
pound in name alphabetical order.
Page | 33
6) Get the description of all products ordered by customernamed Alla
Fahmy
SELECT [Link]
FROM PRODUCT JOIN ORDERPRODUCT
ON [Link]# = [Link]#
JOIN ORDER
ON [Link]# = [Link]#
JOIN CUSTOMER
ON [Link]# = [Link]#
WHERE [Link] = 'Alla Fahmy';
Consider the following relational structure of Educationaldatabase:
Department (dno, dname, manager)
SELECT [Link]
FROM Student JOIN Enrollment
ON [Link]# = [Link]#
JOIN Course
ON [Link]# = [Link]#
WHERE [Link]# = 'S5';
Page | 34
8) Get the student name and course such that the student isenrolled
which belongs to department named Information System
Page | 35
9) Get the name of all students enrolled in course numberCS232
SELECT [Link]
FROM Student JOIN Enrollment
ON [Link]# = [Link]#
JOIN Course
ON [Link]# = [Link]#
WHERE [Link]# = 'CS232';
10) get the student name and course name such that the student isenrolled in
the course which belonges to department named computer science
Page | 36
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 37
12) Get the number and date of all orders with total valuegreater than
10000in date desending order
Page | 38
b) Consider the Company database: Write the SQL statements(DML) for the
following:
14) Get the name and location of all projects controlled with department
with number D3 In desending order of the budget
Page | 39
15) get the names of projects controlled by the departmentnamed
elecrronics
SELECT [Link]
FROM PROJECT JOIN DEPARTMENT
ON [Link] = [Link]
WHERE [Link] = 'Electronics';
16) get the names of all employees working in at least oneproject
controlled by the department named engineering
SELECT DISTINCT [Link]
FROM EMPLOYEE JOIN WORKS-ON
ON [Link] = [Link]
JOIN PROJECT
ON [Link] = [Link]
JOIN DEPARTMENT
ON [Link] = [Link]
WHERE [Link] = 'Engineering';
Page | 40
Get With Nested Quary:
a) Consider the relational structure of Library database:
Get the name of all borrowers has the same status as borrower number 54321
SELECT name
FROM Borrower
WHERE status = (
SELECT status
FROM Borrower
WHERE borrower# = '54321'
);
Page | 41
b) Consider the Company database: Write the SQL statements(DML) for the
following:
Page | 42
3) Get the order number for all orders requested in the same date as the order
number 234567
SELECT ORDER# FROM
ORDER WHERE DATE = (
SELECT DATE
FROM ORDER
WHERE ORDER# = 234567
);
4) Get the name of all students has the same Department asstudent number
S7979
SELECT name
FROM Students
WHERE dno = (
SELECT dno
FROM Students
WHERE sno = 'S7979'
);
Page | 43
Consider the following relational structure of EducationalDatabase:
Department (dno, dname, headOfDepartment)
Student (stud#, sname, city, birthdate, score) Course
(Course#, cname, dno, credit-hours) Enrollment (stud#,
Course#, year, semester, score)
5) get the names of all courses has the same department Asthe course
number IS321
SELECT cname
FROM Course
WHERE dno = (
SELECT dno
FROM Course
WHERE Course# = 'IS321'
);
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 44
6) get the names of all customers have the same credit limit ofthe customer
number C4
SELECT NAME
FROM Customer
WHERE CREDIT_LIMIT = (
SELECT CREDIT_LIMIT
FROM Customer
WHERE CUSTOMER# = 'C4'
);
b) Consider the Company database: Write the SQL statements(DML) for the
following:
7) get the names of all employees have the same birthday ofthe employee
number E3
SELECT ENAME
FROM EMPLOYEE
WHERE BIRTHDAY = (
SELECT BIRTHDAY
FROM EMPLOYEE
WHERE ENO = 'E3'
);
Page | 45
Consider the following relational structure of EducationalDatabase:
Department (dno, dname, headOfDepartment) Student
(stud#, sname, city, birthdate, score) Course (Course#, cname,
dno, credit-hours) Enrollment (stud#, Course#, year, semester,
score)
8) Get the names of all students has the same birthday As thestudent number
S123
SELECT sname
FROM Student
WHERE birthdate = (
SELECT birthdate FROM Student
WHERE stud# = 'S123'
);
b) Consider the Company database: Write the SQL statements(DML) for the
following:
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
PROJECT (PNO, PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
9) Get the names of all Employeeshas the same departmentAs the Empolyee
number E6
Page | 46
SELECT ENAME
FROM EMPLOYEE
WHERE DNO = (
SELECT DNO
FROM EMPLOYEE
WHERE ENO = 'E6'
);
Page | 47
Consider the following relational structure of Educationaldatabase:
Department (dno, dname, manager)
Student (stud#, sname, city, birthday, dno)
DELETE
FROM Enrollment
WHERE stud# = (
SELECT stud#
FROM Student
WHERE sname = 'Shrerif Kamal'
);
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 48
3. Delete All order products for the product named product
DELETE
FROM OrderProduct
WHERE PRODUCT# = (
SELECT PRODUCT#
FROM Product
WHERE DESCREPTION = 'product2'
);
b) Consider the Company database: Write the SQL statements(DML) for the
following:
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
PROJECT (PNO, PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
4. Delete All products controlled by the department namedMechannics
DELETE
FROM Product
WHERE DNO = (
SELECT DNO
FROM Department
WHERE DNAME = 'Mechanics'
);
Page | 49
b) Consider the Company database: Write the SQL statements(DML) for the following:
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
PROJECT (PNO, PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
Page | 50
6. Delete All enrollments of the course named computerGraphics
DELETE
FROM Enrollment
WHERE course# = (
SELECT course#
FROM Course
WHERE cname = 'Computer Graphics'
);
Consider the relational structure of the sales/order database:
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
Page | 51
7. Delete all orders ordered in date 20/11/2021 by customernamed Khaled Aly
DELETE
FROM ORDER
WHERE DATE = '2021-11-20'
AND CUSTOMER# IN (
SELECT CUSTOMER#
FROM CUSTOMER
WHERE NAME = 'Khaled Aly'
);
1) Account A can retrieve or delete from table Reservation but not propagate
these privileges to additional accounts.
Page | 52
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION) PROJECT (PNO,
PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
2)Account A can retrieve or delete from table PROJECT but not propagate these
privileges to additional accounts
GRANT SELECT, DELETE
ON PROJECT
TO A;
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION) PROJECT (PNO,
PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
3)Account A can retrieve or delete from table Department but not propagate these
privileges to additional accounts
GRANT SELECT, DELETE
ON DEPARTMENT
TO A;
Department (dno, dname, manager)
Student (stud#, sname, city, birthday, dno)
Course (course#, cname, dno, credit_hours)
Enrollment (stud#, course#, year, semester, score)
Page | 53
4)Account A can retrieve or delete from table Enrollment but not propagate these
privileges to additional accounts
5)Account A can retrieve or delete from table Works_ON but not propagate these
privileges to additional accounts
GRANT SELECT, DELETE
ON WORKS_ON
TO A;
can retrieve only attributes and can grant any of these privileges
Page | 54
1) Account B can retrieve only attributes stud#, sname, and dno of table
Student and can grant any of these privileges to other accounts
CREATE VIEW v1 AS
SELECT stud#, sname, dno
FROM Student;
GRANT SELECT
ON v1
TO B
WITH GRANT OPTION;
CREATE VIEW v2 AS
SELECT name, status
FROM Borrower;
GRANT SELECT
ON v2
TO B
WITH GRANT OPTION;
Page | 55
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
PROJECT (PNO, PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
CREATE VIEW v3 AS
SELECT PNAME, LOCATION
FROM PROJECT;
GRANT SELECT
ON v3
TO B
WITH GRANT OPTION;
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
ORDER (ORDER#, CUSTOMER#, DATE, TOTAL_VALUE)
ORDERPRODUCT (ORDER#, PRODUCT#, QTY_ORDERED)
PRODUCT (PRODUCT#, DESCREPTION, PRICE, WEIGHT, BALANCE)
CREATE VIEW v4 AS
SELECT PRODUCT#, DESCRIPTION, PRICE
FROM PRODUCT;
GRANT SELECT
ON v4
TO A
WITH GRANT OPTION;
Page | 56
CUSTOMER (CUSTOMER#, NAME, CITY, CREDIT-LIMIT)
ORDER (ORDER#, CUSTOMER#, DATE, TOTAL-VALUE) ORDERPRODUCT (ORDER#,
PRODUCT#, QTY-ORDERED)
PRODUCT (PRODUCT#, PRODUCTNAME, PRICE, BALANCE)
CREATE VIEW v5 AS
SELECT PRODUCTNAME, PRICE
FROM PRODUCT;
GRANT SELECT
ON v5
TO B
WITH GRANT OPTION;
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION)
PROJECT (PNO, PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
GRANT SELECT
ON v6
TO B
WITH GRANT OPTION;
Page | 57
can update , Then Revoke:
Syntax:
GRANT UPDATE (salary)
ON EMPLOYEE
TO C;
1)Account C can update attribute salary of table EMPLOYEE. Then revoke this
privilege
Page | 58
2)Account C can update attribute price of table Book. Then revoke this
privilege
3)Account B can update attribute credit_hour of table Course. Then revoke this
privilege
Page | 59
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
ORDER (ORDER#, CUSTOMER#, DATE, TOTAL_VALUE)
ORDERPRODUCT (ORDER#, PRODUCT#, QTY_ORDERED)
PRODUCT (PRODUCT#, DESCREPTION, PRICE, WEIGHT, BALANCE)
5) Account C can update attribute price of table Book. Then revoke this
privilege
Page | 60
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION) PROJECT (PNO,
PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
6)Account C can update attribute Budget of table Project. Then revoke this
privilege
GRANT UPDATE (Budget)
ON Project
TO C;
7)Account B can update attribute Credit_hour of table Course . Then revoke this
privilege
Page | 61
EMPLOYEE (ENO, ENAME, PHONE, SEX, BIRTHDAY, SALARY, DNO, CITY)
DEPARTMENT (DNO, DNAME, DMGR#, START-DATE, LOCATION) PROJECT (PNO,
PNAME, DNO, BUDGET, PMGR#)
WORKS-ON (ENO, PNO, HOURS)
8)Account C can update attribute salary of table Employee. Then revoke this
privilege
Page | 62
1)Define SQL integrity constraint for the following: No student can be
enrolled in more than 6 courses.
Page | 63
• Department (dno, dname, manager)
• Student (stud#, sname, city, birthday, dno)
• Course (course#, cname, dno, credit_hours)
• Enrollment (stud#, course#, year, semester, score)
3) Define SQL integrity constraint for the following: no student can be enrolled in
more then 6 courses
Page | 64
4)Define SQL integrity constraint for the following:
no employee can work in more than 3 projects at a time
CREATE ASSERTION MaxThreeProjects AS CHECK (
NOT EXISTS (
SELECT ENO
FROM WORKS-ON
GROUP BY ENO
HAVING COUNT(PNO) > 3
)
);
Customer (CUSTOMER#, NAME, ADDRESS, CREDIT_LIMIT)
ORDER (ORDER#, CUSTOMER#, DATE, TOTAL_VALUE)
ORDERPRODUCT (ORDER#, PRODUCT#, QTY_ORDERED)
PRODUCT (PRODUCT#, DESCREPTION, PRICE, WEIGHT, BALANCE)
Page | 65
Book (book# , Title, Author, Publisher, Year, Shelf)
Borrower (borrower#, name , city, status)
Loan (borrower#, book#, date-due-back)
Reservation (borrower# , book#, reservation-date)
Loan-Status (status, max-no-of books, max-loan-period)
6)Define SQL integrity constraint for the following: books published on year
2021 is lent only to borrowers with status staff
Page | 66