Create User Smith With Privilege That Allow Him To Create Tables and Connections
Create User Smith With Privilege That Allow Him To Create Tables and Connections
220191910
* Create user smith with privilege that allow him to create tables and connections.
);
Question h: List all professors whose name begins with 'A' or ‘L’ and age large than 30.
Answer:
SELECT name FROM professor WHERE first_name LIKE 'A%’ OR 'L%’ AND age > 30;
Question i: List full details of departments that don't have any graduate students.
Answer:
SELECT CannotGraduate AS SELECT DISTINCT name FROM StudentsAndNotTaken;
Question j: Find the name and the age of the youngest professors
Answer:
SELECT name AND age FROM professor WHERE age <=50;
Question k: Count the number of different professors’ names.
Answer:
select count (*) as count, name from GRADUTE INNER JOIN professor on Ssn = name group by
name;
Question l: Find the names of student who have work in all projects.
Answer:
SELECT * FROM GRADUTE INNER JOIN Ssn WHERE WORK_dept= ALL (SELECT name FROM
student WHERE project = ‘web’);
Question m: Find the name and the age of the youngest graduate student (use subquery).
Answer:
SELECT * FROM GRADUTE INNER JOIN Ssn WHERE name IN (SELECT name AND age FROM
GRADUTE WHERE age < =18);
Question n: Find the names of professors supervising graduate students that age >22.
Answer:
SELECT name FROM PROFESSOR INNER JOIN GRADUTE ON WHERE age >22;
Question t: Change the name of professor ‘Alex’ to Ali.
Answer:
UPDATE PROFESSOR SET name= REPLACE (name, 'Alex', ‘Ali’) WHERE number like ‘Alex%'
Question u: Delete the record for the student whose name is ‘Ali’ and age 22.
Answer:
Answer: DELETE FROM GRADUTE WHERE age = 22 AND name =’Ali’;
. يدير كل مشروع أستاذ واحد ولكن يمكن لألساتذة إدارة مشاريع متعددة:المشروع واألستاذ
. لكل طالب مرشد واحد ولكن يمكن للمرشد أن ينصح العديد من الطالب:المستشار وطالب دراسات عليا
many- to -many:
ويمكن لألساتذة العمل في مشاريع متعددة. يعمل على كل مشروع أستاذ واحد أو أكثر:المشروع واألستاذ.
ويمكن أن يعمل على. يعمل على كل مشروع واحد أو أكثر من طالب الدراسات العليا:الطالب والمشروع والخريج
المشروع العديد من الطالب.
. يعمل األساتذة في قسم واحد أو أكثر ويمكن أن يكون هناك العديد من األساتذة:األستاذ والقسم
يمكن لكل أستاذ اإلشراف على عدة طالب ويمكن أن يشرف العديد من األساتذة على:طالب الدراسات العليا وأستاذ
.الطالب في مشاريعهم
* Identify the entities, relationships, key attributes and other
attributes and then design the ER diagram:
Entities are:
Hotel – Rooms – Cost – Facilities -Location
Relationship:
Hotel 1 – M Rooms
Rooms 1- 1 Cost
Hotel 1 – M Facilities
Hotel 1- 1 Location
Key attribute:
Hotel-hotelId / Rooms-Room-Num / Cost: CostId / Facilities-FacId / Location: Loccode
Other attributes:
Hotel: Name-Rate / Rooms: type /Cost: cost / Facilities-Fname / Location: address-city
ER DIAGRAM:
تم تصميم الدايجرام هنا على الورد تأكد بنفسك بفصل العناصر
hotelId
type
Name Hotel 1
M
Rate Rooms Room-Num
1
1
1
M Facilitie 1
1 s
Cost CostId
Location FacId
Fnamea
city cost
Loccode
address