67% found this document useful (3 votes)
638 views2 pages

Exam Opt1

The document provides instructions for a SQL final test. It includes: 1) Creating a database called "BasicTech_SQL_FinalTest" and tables for Employees, Timesheets, Departments, Vendors, and Products with the appropriate column constraints and primary keys. Sample data is to be inserted. 2) Writing a query to list employees whose hourly wage is less than the average, including name, SSN, and wage. 3) Specifying departments with 3 or more employees. 4) Printing total working hours for each month of 2006, sorted descending by month. 5) Deleting managers with an hourly wage over $100.

Uploaded by

Phan Phanvankien
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
638 views2 pages

Exam Opt1

The document provides instructions for a SQL final test. It includes: 1) Creating a database called "BasicTech_SQL_FinalTest" and tables for Employees, Timesheets, Departments, Vendors, and Products with the appropriate column constraints and primary keys. Sample data is to be inserted. 2) Writing a query to list employees whose hourly wage is less than the average, including name, SSN, and wage. 3) Specifying departments with 3 or more employees. 4) Printing total working hours for each month of 2006, sorted descending by month. 5) Deleting managers with an hourly wage over $100.

Uploaded by

Phan Phanvankien
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

SQL BasicTech SQL Final Test

For the following requests, print out respectively the screenshots to show test data (the table
data that you create to test each query), the query results, and pack them into the zip file
BasicTech_SQL_FinalTest_AccountName.zip along with your answers, then handle to the
evaluator via email ([email protected])
Barem: Q1: 4. Q2-5: 1.5
You work as a Database Developer for a Global mart. The mart is going to design their own
database. ERD for the future database as below:

Employee has attributes:


- SSN (Social Security Number): Always has 9 characters.
- FirstName: Should be a string in any language. Cannot be NULL
- LastName: Should be a string in any language. Cannot be NULL
- BirthDate: Date of birth. Cannot be NULL
- HireDate: Cannot be NULL and not later than current date.
- HourlyWage. Cannot be NULL.
Timesheet has attributes:
- PayrollDate: Date of payroll. Cannot be NULL.
- WorkingHours: Specific working hours that employee works. Cannot be NULL.
Department has an attributes:
- DepartmentName: Name of department. Cannot be NULL.

Vendor has:
- VendorName: Name of vendor. It should be a string in any language. It cannot be NULL.
- Phone: Cannot be NULL.
- Website.
Product has:
- ProductName: Name of the product. It should be a string in any language. It cannot be
NULL.
- Description: It should be a string in any language
- RetailPrice:
- WholeSalePrice
Q1. Create a database called BasicTech_SQL_FinalTest, then
- Create the tables with the most appropriate column constraints & types. Primary Key of
each table must be INT and auto incremental.
- Add at least 4 records for Department, and at least 10 records for Employee, Vendor,
Product, Timesheet table.
Q2. Writes a query to list out all employee who has HourlyWage less than Hourlywage
average, showing FirstName, LastName, SSN and HourlyWage.
Q3. Specify the departments which have >=3 employees.
Q4. Print out total working hours for each month of 2006. Sort the result descending base on
month.
Q5. Delete managers who has HourlyWage more than 100.

You might also like