Lebanese International University School of Arts and Sciences - Department of Computer Science
Lebanese International University School of Arts and Sciences - Department of Computer Science
/100
Good Luck
Page 1 of 6
CSCI335 Test2 Fall 2020 – 2021
1. We can use DROP statement to remove a database or table permanently from the
system.T
2. We can insert two records with same roll number in a table if roll is assigned as primary
key.F
6. An attribute can reference an attribute from another relation with a FOREIGN KEY
constraint. T
8. During the creation of database schemas, NULL means the field does not have a value;
9. The primary key for a record must never be allowed to have a NULL value.T
10. The ON DELETE CASCADE clause of a foreign key constraint would cause related rows in
11.
Page 2 of 6
CSCI335 Test2 Fall 2020 – 2021
Book (code: int, title: varchar (50), nbpage: int, price: int)
Author
Write
id name Email
1 John [email protected] AuthorID BookCode PublishedDate
2 Farid [email protected] 1 5 10/10/2020
3 Harvey Deitel, Paul Deitel [email protected] 4 3 2/6/2019
4 Mari [email protected] 4 1 3/11/2021
1 1 1/1/2018
Book
code title Nbpage price
1 Programming with Java 512 50
3 DBMS 250 75
2 Python 300 pages 35
NULL A+ Certificate 550 100
Page 3 of 6
CSCI335 Test2 Fall 2020 – 2021
7. Add new book to the book table with code =3, title = database, nbpage = 300 and price =
320
a) Cannot insert, violation
b) Insert into book(3,’database’,300,320)
c) Insert into table book(3,”database”,300,320)
d) Insert into book(“3”,”database”,”300”,”320”)
8. What is the number of tuples retrieved after executing the following query:
a. 1
b. 2
c. 3
a) 4
9. Which of the following queries will generate an error when executed?
a. Insert into Write values (2 ,2 , 11/12/2020)
b. Insert into Write values (4, 3, 20/2/2020)
c. Insert into Write values (1,5 , 1/5/2019)
a) All of the above
10. Which of the following queries allows us to delete from the Book table all the entries whose
price is above 75:
a. Delete from Book where price is greater than 75
b. Delete from Write where price > 75
c. Delete from Book where price is above 75
a) Delete from Book where price > 75
Page 4 of 6
CSCI335 Test2 Fall 2020 – 2021
Sailor Reservation
sid sname rating age
sid bid date
22 103 10/10/2019
22 Samer 7 21
31 101 11/12/2020
31 Hani 10 25
22 103 12/10/2021
58 Ramz 10 35 58 105 08/12/2018
i
62 Rita 6 23
Bike
bid bname color
A.In which order we must fill the above tables (which table first, second and third). Justify briefly
your answer [4 pts]
OR
Page 5 of 6
CSCI335 Test2 Fall 2020 – 2021
2. Find the sids and the sname of sailors who have reserved a red bike.
Select sid , sname from sailor s , bike b , reservation r where s.sid = r.sid and
3. Find the name of the sailor(s) who have reserved a red or a blue bike
Select sid , sname from sailor s , bike b , reservation r where s.sid = r.sid and
Page 6 of 6