1. Create a new table called CATEGORIES. The columns should be CatCode and CatDesc. The CatCode...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Create a new table called CATEGORIES. The columns should be CatCode and CatDesc. The CatCode column should store a maximum of 2 characters, and the CatDesc column should store a maximum of 10 characters. 2. Create a new table called WOKERS containing four columns: Emp#, Lastname, Firstname, and Job_class. The Job_class column should be able to store character strings up to a maximum length of four, but the column values shouldn't be padded if the value has less than four characters. The Emp# column contains a numeric ID and should allow a five-digit number. Use column sizes you consider suitable for the Firstname and Lastname columns. 3. Add two columns to the WOKERS table. One column, named EmpDate, contains the date of employment for each employee, and its default value should be the system date. The second column, named EndDate, contains employees' date of termination. 4. Modify the Job_class column of the WOKERS table so that it allows storing a maximum width of two characters. 5. Delete the EndDate column from the WOKERS table. 6. Rename the WOKERS table as EMPS. 7. Create a new table called NOVEL: It will have the following columns: ISBN, Cost, Retail, and Category. 8. Rename the new table PRICING_OF_BOOK. 9. Mark the Category column of the PRICING_OF_BOOK table as unused. Verify that the column is no longer available. Add some data into PRICING_OF_BOOK table. 10. Truncate the PRICING_OF_BOOK table, and then verify that the table still exists but no longer contains any data. 11. Delete the PRICING_OF_BOOK table permanently so that it isn't moved to the recycle bin. Question 2 (5 marks) Create two tables based on the E-R model shown in Figure 4-41 and the business rules in the following list for a work order tracking database. Include all the constraints in the CREATE TABLE statements. You should have only two CREATE TABLE statements and no ALTER TABLE statements. Name all constraints except NOT NULLs. Project Proj P_name P desc P_budget FIGURE 4-41 Workorders ● Woll Proj Wo_desc Wo_assigned Wo hours Wo start. Wo due Wo complete Will hold a name for the person assigned Workorders E-R model • Use your judgment for column datatypes and sizes. Proj# and Wo# are used to uniquely identify rows in these tables. • Each project added must be assigned a name, and no duplicate project names are allowed. Dates Will hold a Y or N • Each work order must be assigned to a valid project when added and be assigned a description and number of hours. • Each work order added must have a different description. • The number of hours assigned to a work order should be greater than zero. • If data is provided for the Wo_complete column, only Y or N are acceptable values. • Each table should have 5 data records in them Create and execute the SQL statements needed to enforce the data relationships among these tables. 1. Create a new table called CATEGORIES. The columns should be CatCode and CatDesc. The CatCode column should store a maximum of 2 characters, and the CatDesc column should store a maximum of 10 characters. 2. Create a new table called WOKERS containing four columns: Emp#, Lastname, Firstname, and Job_class. The Job_class column should be able to store character strings up to a maximum length of four, but the column values shouldn't be padded if the value has less than four characters. The Emp# column contains a numeric ID and should allow a five-digit number. Use column sizes you consider suitable for the Firstname and Lastname columns. 3. Add two columns to the WOKERS table. One column, named EmpDate, contains the date of employment for each employee, and its default value should be the system date. The second column, named EndDate, contains employees' date of termination. 4. Modify the Job_class column of the WOKERS table so that it allows storing a maximum width of two characters. 5. Delete the EndDate column from the WOKERS table. 6. Rename the WOKERS table as EMPS. 7. Create a new table called NOVEL: It will have the following columns: ISBN, Cost, Retail, and Category. 8. Rename the new table PRICING_OF_BOOK. 9. Mark the Category column of the PRICING_OF_BOOK table as unused. Verify that the column is no longer available. Add some data into PRICING_OF_BOOK table. 10. Truncate the PRICING_OF_BOOK table, and then verify that the table still exists but no longer contains any data. 11. Delete the PRICING_OF_BOOK table permanently so that it isn't moved to the recycle bin. Question 2 (5 marks) Create two tables based on the E-R model shown in Figure 4-41 and the business rules in the following list for a work order tracking database. Include all the constraints in the CREATE TABLE statements. You should have only two CREATE TABLE statements and no ALTER TABLE statements. Name all constraints except NOT NULLs. Project Proj P_name P desc P_budget FIGURE 4-41 Workorders ● Woll Proj Wo_desc Wo_assigned Wo hours Wo start. Wo due Wo complete Will hold a name for the person assigned Workorders E-R model • Use your judgment for column datatypes and sizes. Proj# and Wo# are used to uniquely identify rows in these tables. • Each project added must be assigned a name, and no duplicate project names are allowed. Dates Will hold a Y or N • Each work order must be assigned to a valid project when added and be assigned a description and number of hours. • Each work order added must have a different description. • The number of hours assigned to a work order should be greater than zero. • If data is provided for the Wo_complete column, only Y or N are acceptable values. • Each table should have 5 data records in them Create and execute the SQL statements needed to enforce the data relationships among these tables.
Expert Answer:
Answer rating: 100% (QA)
It seems you need assistance with SQL tasks related to creating and modifying database tables as well as establishing data relationships Lets go through the steps individually based on the instruction... View the full answer
Related Book For
Posted Date:
Students also viewed these databases questions
-
1 Why should an organization develop a marketing strategy? What is the difference between strategic market planning and the marketing plan? 2 Identify the major components of strategic market...
-
Create a new table containing these four columns: Emp#, Lastname, Firstname, and Job_class. The table name should be EMPLOYEES. The Job_class column should be able to store character strings up to a...
-
The owner of Colonial Adventure Tours knows the importance of the SQL language in database management. He realizes that he can use SQL to perform the same functions that you performed with queries in...
-
Using the information from 2-16, create a cash flow statement for 2013. In 2-16 Bristle Brush-Off Corporation: Income Statements for Years Ended December 31 ($000s) 2013 2012 $7,950 5,100 350 750...
-
A uniformly loaded square crate is falling freely with a velocity v0 when cable AB suddenly becomes taut. Assuming that the impact is perfectly plastic, determine the angular velocity of the crate...
-
(a) Write the mass balance for CaCl 2 in water if the species are Ca 2+ and Cl - . (b) Write the mass balance if the species are Ca 2+ , Cl - , CaCl - , and CaOH + . (c) Write the charge balance for...
-
Again consider the 400 parts in Table 2.2. From this table, \[ P(D \mid F)=\frac{P(D \cap F)}{P(F)}=\frac{10}{400} / \frac{40}{400}=\frac{10}{40} \] Note that in this example all four of the...
-
A study by Becker Associates, a San Diego travel consultant, found that 30% of the traveling public said that their flight selections are influenced by perceptions of airline safety. Thirty-nine...
-
David has borrowed $600 from the bank. The bank is charging him an interest of 18.39% compounded monthly. David would like to pay back the entire loan with a single payment 3 years from today. How...
-
Hank has a 30% interest in KKC LLC, a calendar year entity. At the beginning of the year, Hank had an outside basis in KKC of $60,000 which included his $10,000 share of KKC liabilities. On July 1st,...
-
Your friend Lorenzo smith from Yorkville university just got a job as an investment analyst for a major Canadian financialinstitution. Lorenzo had a93% average; however, everyone knows that he...
-
What organization is the watchdog organization for watching over the safety of employees and the workplace?
-
What is it called when leaders' behaviors encourage and support their employees so that they are able to grow, develop, and excel on the job?
-
When managers have referent power over coworkers and subordinates, what does that mean? Multiple choice question. Managers are able to reward their subordinates as they deem appropriate. Managers...
-
What impact do you think the way you dress has on the way a future employer views you? Be sure to address the following questions in your writing: Explain how your choice of clothing can affect your...
-
This answers the question "why." What issue(s) does your project/program address? Why does it matter? Who benefits? Why is the project you're proposing the "best" way to meet the need(s)?
-
The diameter of a specific copper wire is 8.084 mm,and has a resistivity of 1.72 10 -8 ??m. Find the resistance of a 0.85 km length of such wireused for power transmission in ?.
-
What are the risks and liability factors in an audit? What are the implications to the auditor? What are the implications to the organization? How can the auditor mitigate these risks and liability...
-
For the following exercises, identify the conic with focus at the origin, and then give the directrix and eccentricity. r= 2 3 sin 0
-
If we want to model cumulative rainfall over the course of a year, would a sinusoidal function be a good model? Why or why not?
-
For the following exercises, assume is opposite side a, is opposite side b, and is opposite side c. If possible, solve each triangle for the unknown side. Round to the nearest tenth. = 120, b =...
-
In problem 49, when does the estate's taxable year end? problem 49, John Henry died on May 1, 2018. When does his final 1040 have to be filed?
-
John Henry died on May 1, 2018. When does his final 1040 have to be filed?
-
John and Mary Hughes file their income tax return on a calendar year basis. John dies on May 15, 2018. Mary remarries on July 4, 2018. Can Mary file a joint return with John for the taxable year 2018?
Study smarter with the SolutionInn App