Construct a SQL Data Definition Language (DDL) for the following statement: a) Define the ORDERS relation...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Construct a SQL Data Definition Language (DDL) for the following statement: a) Define the ORDERS relation which has the following constraints. Data Type Constraints Attribute orderNo Integer of length 7 Primary Key ordDate custNo prodNo quantity Date Various characters of length 5 Foreign Key where the reference relation is Various characters of length 6 Integer CUSTOMER(custNo) Foreign Key where the reference PRODUCT(pCode) relation is b) Modify the ORDERS relation such that the attribute order No holds the same data type as prodNo in PRODUCT relation. c) Add a new attribute named totalPrice in the ORDERS relation that reflects the total sum of money to be paid for the order. d) Add a constraint to the totalPrice attribute in the ORDERS relation where the default value is set to NOT NULL. e) Create a new relation named NEWORDERS that has the same structure as ORDERS. f) Delete the ORDERS relation from your database. g) Recover the deleted ORDERS relation to your database and rename the relation to OLDORDERS. Construct a SQL Data Definition Language (DDL) for the following statement: a) Define the ORDERS relation which has the following constraints. Data Type Constraints Attribute orderNo Integer of length 7 Primary Key ordDate custNo prodNo quantity Date Various characters of length 5 Foreign Key where the reference relation is Various characters of length 6 Integer CUSTOMER(custNo) Foreign Key where the reference PRODUCT(pCode) relation is b) Modify the ORDERS relation such that the attribute order No holds the same data type as prodNo in PRODUCT relation. c) Add a new attribute named totalPrice in the ORDERS relation that reflects the total sum of money to be paid for the order. d) Add a constraint to the totalPrice attribute in the ORDERS relation where the default value is set to NOT NULL. e) Create a new relation named NEWORDERS that has the same structure as ORDERS. f) Delete the ORDERS relation from your database. g) Recover the deleted ORDERS relation to your database and rename the relation to OLDORDERS.
Expert Answer:
Answer rating: 100% (QA)
a Define the ORDERS relation CREATE TABLE ORDERS orderNo INT7 NOT NULL P... View the full answer
Related Book For
Data Modeling and Database Design
ISBN: 978-1285085258
2nd edition
Authors: Narayan S. Umanath, Richard W. Scammel
Posted Date:
Students also viewed these databases questions
-
Amidst the evolving landscape of global finance, what are the emerging trends and challenges pertaining to cross-border insolvency regimes, including the harmonization of legal frameworks,...
-
1) Create Oracle database tables using SQL Data Definition Language (DDL) for each table listed in the metadata of Project 2. You may need to use a combination of DROP TABLE, CREATE TABLE, and ALTER...
-
What might be a good government policy to solve the problem of the environmental externality that leads to high greenhouse gas emissions? Explain in detail.
-
Ebbers Corporation overstated its ending inventory balance by $15,000 in the current year. What impact will this error have on cost of goods sold and gross profit in the current year and following...
-
Calculate the change in entropy when 50 k] of energy is transferred reversibly and isothermally as heat to a large block of copper at (a) OC, (b) 70e
-
Debentures are shown in the company Balance Sheet under A. Reserve and Surplus B. Non-current Liabilities C. Current Liabilities D. Short-term Borrowings
-
There are two propositions: (a) I flip a coin. If it is heads, you are paid \$3; if it is tails, you are paid \(\$ 0\). It costs you \(\$ 1\) to participate in this proposition. You may do so at any...
-
The following balance sheet for the Hubbard Corporation was prepared by the company: Additional information: 1. The buildings, land, and machinery are all stated at cost except for a parcel of land...
-
Using the data from problem 3-24, complete the following steps: 1. Prepare a schedule to determine goodwill and to allocate fair value 2. Prepare a schedule to determine the balance in the...
-
On December 31, 20X0, Toms River Rafting, Inc. (TRR), has a deferred tax asset related to a $250,000 net operating loss carryforward. The enacted tax rate (and substantively enacted tax rate) at the...
-
How do organizations balance the needs and preferences of their employees with the constraints and goals of the organization when designing a compensation and benefits program?
-
Solve the equation. 6 7 + 1 11 MN
-
K Divide the fractions. 2 10 21*35
-
Solve using the substitution method. x+y= 1 y = -2x-5
-
Suppose 1 an converges. Prove that lim r-1, r <1 n=1 ran = An. n=1
-
Find the missing length of the triangle 40 75 Feet a) 62.9 feet b) 48.2 feet c) 57.5 feet d) 72.2 feet
-
Which of the following is not a required disclosure requirement under both U.S. GAAP and IFRS? A. The amount of any impairment loss reversal if not separately disclosed in the income statement. B....
-
The tractor is used to lift the 150-kg load B with the 24-mlong rope, boom, and pulley system. If the tractor travels to the right at a constant speed of 4 m/s, determine the tension in the rope when...
-
What is the difference between total specialization and partial specialization and how is each reflected in an ER diagram?
-
What is the difference between an exclusive arc and an inclusive arc?
-
Under what circumstances in a specialization is it possible for both one superclass to be related to more than one subclasses and one subclass to be related to one or more superclasses?
-
For each of the following sets of numbers, calculate a \(95 \%\) confidence interval for the mean ( \(\sigma\) known); before going through the steps in calculating the confidence interval, the...
-
Consider a 3 -year \(10 \%\) coupon bond. The underlying short rate of interest follows a lattice with initial value of \(R=1.15\) and then has an factor of 1.02 , a down factor of .99 , and...
-
Using the density function of the stopping time probability for a fixed \(\lambda\), find the average time to the first event over the entire interval \([0, \infty)\).
Study smarter with the SolutionInn App