SQL TS Final

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

It & Technology

City International College (TS)


Duration: 60min
Date: … /… /2024 Second semester
Exam
Name: ……………………… SQL Note

Exercise 1: (5pts)

Observe the given Table TEACHER and give the output of question (i) and (ii)

(i) SELECT TEACHER_NAME,DOJ FROM TEACHER WHERE TEACHER_NAME LIKE %I%;


(ii) SELECT FROM TEACHER WHERE DOJ LIKE %-09-%;

Exercice2: (15pts)
Giving the following tables concerning a grading system in a university:

1- Student (StudentNumber, StudentName, BirthDate, Phone, BloodGroup, City , ClassNumber)


2- Course (CourseNumber, CourseName)
3- Class (ClassNumber, ClassName, Faculty)
4- Professor (ProfNumber, ProfLastName, ProfFirstName)
5- Examination (StudentNumber, ExamDate, CourseNumber, ProfNumber, Grade)

The constraints concerning the table Examination:


 All fields are required.
 The field examDate is by default the system date.
 The field grade can take any integer value between 0 and 20.

Questions:
Formulate in SQL the following queries:
a) Create the tables Student,Course and Class indicating the primary key, the foreign key(s) and
the constraints.
b) Add the column "NumberOfCredits" to the table “Course”, the NumberOfCredits is between 3
and 9 credits.
c) Add a new student with the following information: (1000, Joe Smith, 15/8/2000, 70/123456, A+,
Saida, 12), knowing that 12 is the class number for the class “TS2 Info” in faculty “Business”
which is not inserted yet in the database.
d) Modify the phone number to 03/112233 for the student having the number 1005.
e) Remove all records from the table “Examination”.
f) Display, in alphabetic order, a list of students (number, name) who belong to the faculty
“Engineering”.
g) Display the professor full name having the highest number of examinations.
h) Display a list of students (name, phone) who have an age less than 18 years and have a grade
greater than 15 for the course “Data Base” during the year 2014.

Good luck☺

You might also like