Knowee
Questions
Features
Study Tools

Create the MENUS table with the Price column should have a constraint named chk_price to ensure the value is greater than 0.Create the ORDERS table with the Quantity column should have a constraint named chk_quantity to ensure the value is greater than 0.After creating the tables, Mia needs to:Alter the MENUS table to drop the existing chk_price constraint, as the pricing strategy has been updated. Add a new CHECK constraint named chk_price_new to ensure that the Price is at least $5.Alter the ORDERS table to drop the existing chk_quantity constraint, as the quantity policy has changed. Add a new CHECK constraint named chk_quantity_new to ensure that the Quantity is between 1 and 100.

Question

Create the MENUS table with the Price column should have a constraint named chk_price to ensure the value is greater than 0.Create the ORDERS table with the Quantity column should have a constraint named chk_quantity to ensure the value is greater than 0.After creating the tables, Mia needs to:Alter the MENUS table to drop the existing chk_price constraint, as the pricing strategy has been updated. Add a new CHECK constraint named chk_price_new to ensure that the Price is at least $5.Alter the ORDERS table to drop the existing chk_quantity constraint, as the quantity policy has changed. Add a new CHECK constraint named chk_quantity_new to ensure that the Quantity is between 1 and 100.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here are the SQL commands to perform the tasks:

  1. Create the MENUS table with the Price column and a constraint named chk_price:
CREATE TABLE MENUS (
    Price DECIMAL(10,2),
    CONSTRAINT chk_price CHECK (Price > 0)
);
  1. Create the ORDERS table with the Quantity column and a constraint named chk_quantity:
CREATE TABLE ORDERS (
    Quantity INT,
    CONSTRAINT chk_quantity CHECK (Quantity > 0)
);
  1. Alter the MENUS table to drop the existing chk_price constraint and add a new CHECK constraint named chk_price_new:
ALTER TABLE MENUS
DROP CONSTRAINT chk_price;

ALTER TABLE MENUS
ADD CONSTRAINT chk_price_new CHECK (Price >= 5);
  1. Alter the ORDERS table to drop the existing chk_quantity constraint and add a new CHECK constraint named chk_quantity_new:
ALTER TABLE ORDERS
DROP CONSTRAINT chk_quantity;

ALTER TABLE ORDERS
ADD CONSTRAINT chk_quantity_new CHECK (Quantity BETWEEN 1 AND 100);

Please replace the column types and sizes (DECIMAL(10,2), INT) with the actual ones you need.

This problem has been solved

Similar Questions

If goods P and Q are jointly demanded, an increase in the price of p will likely*1 pointA. leave the demand for Q constant but reduce the quantity demanded of P.B. reduce the quantity demanded of P but increase the price of Q.C. increase the quantity supplied of QD. decrease the quantity demanded of Q

Create the BATCH table with a foreign key constraint named FK_DRUG_ID to reference the DRUG table's DRUG_ID column, ensuring each batch is associated with a specific drug. Include a check constraint named CK_QUANTITY to ensure the QUANTITY column has a positive value.

Create a table named orders with columns "order_id" (int), "customer_id" (int), "order_date" (date), "total_amount" (decimal), and "status" (varchar). The table should be configured with constraints such that "order_id" and "customer_id" cannot be empty, and "order_id" serves as the primary key.

Max chooses to purchase movie tickets and restaurant meals every week with his $100. If the price of a movie ticket is $20 and the price of a restaurant meal is $25, then the slope of his budget constraint will be,Group of answer choices1/5-1/54/5-4/5

Identify five business constraints that should be considered when designing a menu.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.