تحليل وتصميم قواعد بيانات
Відкрити в Telegram
هذا القروب يهتم بقواعد البيانات database oracle access mysql ومناقشة الافكار والمخططات وحل المشاكل البرمجية وتبادل الافكار والمعلومات وكذلك تصميم وتطوير مواقع الويب Html css javascript Jquery ajax Php
Показати більшеІракКатегорія не вказана
4 077
Підписники
Немає даних24 години
Немає даних7 днів
Немає даних30 днів
Архів дописів
Works Table Queries in SQL

2. Below tables form part of an employee database. Identify the superkey, primary, and foreign keys in "works" table. Also how could you apply entity, referential, and general integrity constraints for same table (i.e. works table)? Then give an expression in SOL for FOUR of the following queries: (9 marks) Employee (Employee number, employee name, street, city) Company (Company number, company name, city) Works (Working number, employee number, company number, salary) Manages (Employee name, manager name). a) Create "works" table. b) Insert data into "works" table. c) Delete data from "works" table. d) Find the names of all employees who work for First Bank Corporation. e) Find all employees in the database who live in the same cities as the companies for which they work. f) Find all employees who earn more than the average salary of all employees of their company.
ChatGPT
The "works" table is as follows:
Works (Working number, employee number, company number, salary)
In this table, the superkey is the combination of all attributes: (Working number, employee number, company number, salary). It uniquely identifies each row in the table.
The primary key in the "works" table is the Working number attribute. It uniquely identifies each row in the table.
The foreign keys in the "works" table are the employee number and company number attributes. They refer to the Employee table and Company table, respectively.
To apply entity, referential, and general integrity constraints for the "works" table, we can use the following:
Entity Integrity Constraint: This ensures that the primary key attribute is unique and not null. In the "works" table, the primary key attribute Working number should be unique and not null.
Referential Integrity Constraint: This ensures that foreign key references are valid and that no referencing rows are deleted. In the "works" table, the foreign key attributes employee number and company number should reference valid values from the Employee table and Company table, respectively.
General Integrity Constraints: These constraints define additional rules or conditions that the data must satisfy. For example, a general integrity constraint for the "works" table could be a constraint on the salary attribute to ensure it is a positive value.
Expressions in SQL for the provided queries:
a) Create "works" table:
sql
CREATE TABLE works ( Working_number INT PRIMARY KEY, Employee_number INT, Company_number INT, Salary DECIMAL(10,2), FOREIGN KEY (Employee_number) REFERENCES Employee(Employee_number), FOREIGN KEY (Company_number) REFERENCES Company(Company_number) );
b) Insert data into "works" table:
sql
INSERT INTO works (Working_number, Employee_number, Company_number, Salary) VALUES (1, 1001, 2001, 5000), (2, 1002, 2001, 5500), (3, 1003, 2002, 6000);
c) Delete data from "works" table:
sql
DELETE FROM works WHERE Working_number = 2;
d) Find the names of all employees who work for First Bank Corporation:
sql
SELECT e.employee_name FROM works w JOIN employee e ON w.employee_number = e.employee_number JOIN company c ON w.company_number = c.company_number WHERE c.company_name = 'First Bank Corporation';
e) Find all employees in the database who live in the same cities as the companies for which they work:
sql
SELECT e.employee_name FROM works w JOIN employee e ON w.employee_number = e.employee_number JOIN company c ON w.company_number = c.company_number WHERE e.city = c.city;
f) Find all employees who earn more than the average salary of all employees of their company:
sql
SELECT e.employee_name FROM works w JOIN employee e ON w.employee_number = e.employee_number JOIN company c ON w.company_number = c.company_number WHERE w.salary > ( SELECT AVG(salary) FROM works WHERE company_number = w.company_number );
Free Research Preview.
DECLARE
filename VARCHAR2(256)
BEGIN
filename := GET_FILE_NAME(File_Filter=> any Files;
READ_IMAGE_FILE(filename, ’jpg’, 'emp.emp_pic');
END;
ولاية خراسان
بتوفيق الله تعالى، استهدف جنود الخلافة آلية لميليشيا طالبان المرتدة في (الناحية 4) من مدينة (جلال أباد) أمس، بتفجير عبوة ناسفة، ما أدى لمقتل وإصابة 3 عناصر وتضرر الآلية، ولله الحمد.
🎓 #الماجيستير_المهني_في_ادارة_الاعمال-MBA
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
🟧 البرامج التي يتم دراستها :-
1️⃣الدبلوم المهني في إدارة الموارد البشرية HRM
2️⃣ الدبلوم المهني في إدارة الأعمال PA
3️⃣دبلوم العلاقات العامة والتسويق
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
التسجيل فى الاستمارة الالكترونية
https://forms.gle/GDXGDUxoFBtLc9rx7
📱 للتواصل المباشر عبر الواتساب
https://wa.me/00966546975651
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
شهادات ( الماجستير المهني في ادارة الاعمال MBA ) باعتماد و تصديق :
1- وزاره الخارجيه المصرية
( ويمكنك التصديق علي الشهادة من خارجية دولتك ايضا )
2- مكتب التصديقات القنصلي ( لكل شهادة رقم تصديق قنصلي )
3- اكاديمية كامبس الدولية ICompass Academy
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
اكاديمية كامبس الدولية - بوصلتك للتطوير والتقدم
