Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Table: fudgemart_timesheets: columns Column Name Data Type Default Value Allow Null? timesheet_id i nt identity(1,1) No timesheet_payrolldate Datetime No timesheet_employee_id Int No timesheet_hours decimal(3,1) 40.0

Table: fudgemart_timesheets: columns

Column Name

Data Type

Default Value

Allow Null?

timesheet_id

int identity(1,1)

No

timesheet_payrolldate

Datetime

No

timesheet_employee_id

Int

No

timesheet_hours

decimal(3,1)

40.0

No

Table: fudgemart_timesheets: constraints

Constraint Name

Constraint Type

Data

pk_timesheet_id

Primary key

timesheet_id

fk_timesheet_employee_id

Foreign key

timesheet_employee_id REFERENCES fudgemart_employees(employee_id)

ck_timesheet_hours

Check

timesheet_hours between 0 and 60

*Notice the data type on our timesheet_id. From lecture, you should recall thats how to code a surrogate key data type in SQL.

Section 3: On your own: Fudgemart Employees and Timesheets

In this section we will create the fudgemart_timesheets table object and add some required data. Make sure youve completed your pre-lab before working on this section. In order to use these as helpful samples moving forward, write these queries in the sql file you should have used for part 1.

3.a) Write the SQL CREATE TABLE statement to create the fudgemart_timesheets table columns only as outlined earlier in the lab (above). Do not create any constraints at this time.

3.b) Write the SQL ALTER TABLE statement to add all the constraints to the fudgemart_timesheets table constraints as outlined in section 1.b of the lab.

3.c) Write SQL INSERT statements to add one week of timesheets for each employee (6 inserts total) for the week of 9/10/2020. Each employee worked 45 hours total. After youve successfully ran the insert, write and run a select statement to retrieve the rows you just entered.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Why is it important to limit the scope of presentations? [LO-1]

Answered: 1 week ago