The document contains SQL commands for altering tables in a database, including adding foreign key constraints, check constraints, and unique constraints for various tables such as Employees, Departments, Projects, Attendance, and Salaries. It also includes several SELECT queries to retrieve average bonuses, employee details, and attendance records based on specific conditions. Overall, the document focuses on database schema modifications and data retrieval operations.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views2 pages
SQLSample Questions Answers
The document contains SQL commands for altering tables in a database, including adding foreign key constraints, check constraints, and unique constraints for various tables such as Employees, Departments, Projects, Attendance, and Salaries. It also includes several SELECT queries to retrieve average bonuses, employee details, and attendance records based on specific conditions. Overall, the document focuses on database schema modifications and data retrieval operations.
a.CheckInTime FROM Employees e JOIN Departments d ON e.DepartmentID = d.DepartmentID JOIN Attendance a ON e.EmployeeID = a.EmployeeID WHERE a.WorkDate = '2023-10-24' AND a.CheckInTime > '08:30:00';
15 - SELECT COUNT(*) AS EmployeesCheckedInAfter830
FROM Attendance WHERE WorkDate = '2023-10-24' AND CheckInTime > '08:30:00';
16 - SELECT SUM(BaseSalary) AS TotalBaseSalary, SUM(Bonus) AS TotalBonus