Question

An objective of this task is to implement SQL script that verifies the following logical consistency constraint imposed...

An objective of this task is to implement SQL script that verifies the following logical consistency constraint imposed on the contents of a sample database. "All orders submitted after 30 April 2019 must not include discontinued products" Download a file solution1.sql and insert into the file the implementations of the following actions.

(1) First, the script inserts into a sample database information about a new order submitted today that includes two products. One of the products is discontinued while the other is not discontinued. You are allowed to examine the contents of a sample database to find out which products are discontinued and which products are not discontinued and later on apply INSERT statements to implement this step. All other information related to a new order is up to you.

(2) Next, the script creates a single column relational table MESSAGE to store variable size strings no longer than 500 characters.

(3) Next, the script inserts into a relational table MESSAGE information about the contents of a sample database that violate the following consistency constraint. "All orders submitted after 30 April 2019 must not include discontinued products" The script must list the outcomes of verification of the consistency constraint as a single column table with the following messages as the rows in the table. Order submitted on includes a discontinued product

For example, if order_id of an order submitted on 1 May 2019 is equal to 278 and product Chai is discontinued and the product is included into the order then verification of the consistency constraint must return the following message. Order 278 submitted on 2019-05-01 includes a discontinued product Chai Use a function CONCAT to create the messages like the one listed above.

(4) Finally, the script makes the contents of a relational table MESSAGE permanent and lists the contents of the table.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answering first two parts as per standard:

1)INSERT INTO ORDERS(ID,CUSTOMER_NAME,ADDRESS,ORDER_VALUE,PRODUCT_STATUS)
VALUES (1, 'SAMPLE_NAME','SAMPLE_ADDRESS', 1000,'DISCONTINUED');

INSERT INTO ORDERS(ID,CUSTOMER_NAME,ADDRESS,ORDER_VALUE,PRODUCT_STATUS)
VALUES (2, 'SAMPLE_NAME','SAMPLE_ADDRESS', 2000,'AVAILABLE');


2)CREATE TABLE MESSAGE(

MESSAGE varchar(500)
);

Add a comment
Know the answer?
Add Answer to:
An objective of this task is to implement SQL script that verifies the following logical consistency constraint imposed...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primar

    Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primary key,                 Decription           varchar2(30),                 Unitcost               number(7,2)); Create table Customer(                 custID                   char(5) constraint cid.unique primary key,                 custName          varchar2(20),                 address                                varchar2(50)); Create table Orderdata( orderID                char(5) constraint oid_uniq primary key,                 orderdate           date,                 shipdate              date,                 ItemId                  char(5) references Item.ItemId,                 No_of_items     number(4),                 Unitcost               number(7,2),                 Order_total        number(7,2),                 custID                   char(5) references customer.custID); Insert Into Item values(‘A123’,’Pencil’,2.5); Insert Into Item values(‘B123’,’Pen’,15); Insert Into...

  • database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED...

    database and sql problme THE QUESTIONS 3, 4,5 and 6 REFER TO THE RELATIONAL TABLES LISTED BELOW CREATE TABLE Department ( DECIMAL(5) VARCHAR(30) CHAR(5) DATE NOT NULL NOT NULL NOT NULL * Department number /*Department name * Department manager number */ /Manager start date DNumber DName Manager MSDate CONSTRAINT Department_PK PRIMARY KEY(DNumber) CONSTRAINT Department_CK UNIQUE(DName) CREATE TABLE DeptLocation DECIMAL(5) VARCHAR(50) NOT NULL NOT NULL DNumber * Department number */ * Department location */ Address CONSTRAINT DeptLocation_PK PRIMARY KEY(DNumber, Address) CONSTRAINT...

  • 2. Write a script that implements the following design: In the Downloads table, the user_id and...

    2. Write a script that implements the following design: In the Downloads table, the user_id and product_id columns are the foreign keys. Create these tables in the ex schema. Create the sequences for the user_id, download_id, and product_id columns. Include a PL/SQL script to drop the table or sequence if it already exists. Include any indexes that you think are necessary. 3. Write a script that adds rows to the database that you created in exercise 2. Add two rows...

  • The lab for this week addresses taking a logical database design (data model) and transforming it...

    The lab for this week addresses taking a logical database design (data model) and transforming it into a physical model (tables, constraints, and relationships). As part of the lab, you will need to download the zip file titled CIS336Lab3Files from Doc Sharing. This zip file contains the ERD, Data Dictionary, and test data for the tables you create as you complete this exercise. Your job will be to use the ERD Diagram found below as a guide to define the...

  • This code must be in SQL - Run the script provided with the assignment. This will...

    This code must be in SQL - Run the script provided with the assignment. This will create the tables used for this assignment. Write the necessary SQL commands to perform the required actions. Run the queries to obtain results from the database. (Make sure all columns returned have proper headings.) 3 2 In a single row show the following values: how many unique manufacturers are in the products table. What is the most expensive price per unit in the products...

  • * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following...

    * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following tables: VENDOR, PRODUCT, CUSTOMER, INVOICE, LINE EMPLOYEE and loads the default data rows */ set echo on; set serveroutput on; select systimestamp from dual; show user; ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; DROP TABLE LINE CASCADE CONSTRAINTS; DROP TABLE INVOICE CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE VENDOR CASCADE CONSTRAINTS; DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE...

  • SQL Query Question: I have a database with the tables below, data has also been aded...

    SQL Query Question: I have a database with the tables below, data has also been aded into these tables, I have 2 tasks: 1. Add a column to a relational table POSITIONS to store information about the total number of skills needed by each advertised position. A name of the column is up to you. Assume that no more than 9 skills are needed for each position. Next, use a single UPDATE statement to set the values in the new...

  • Question 1.Write a SQL statement for each of the following questions based on the above tables...

    Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...

  • I NEED TO WRITE THE FOLLOWING QUERIES IN MYSQL (13)Next, grant to a user admin the read privileges on the complete descr...

    I NEED TO WRITE THE FOLLOWING QUERIES IN MYSQL (13)Next, grant to a user admin the read privileges on the complete descriptions of the customers who submitted no orders. For example, these are the customers who registered themselves and submitted no orders so far. The granted privilege cannot be propagated to the other users. 0.3 (14)Next, grant to a user admin the read privileges on information about the total number of orders submitted by each customer. Note, that some customers...

  • An online company sells hundreds of office supply products on its e-Commerce store. It has asked...

    An online company sells hundreds of office supply products on its e-Commerce store. It has asked you to design and implement a sales order processing system which will be used by users in our Operations department to process sales orders. Here is an overview of the sales order process. Customers make purchases by placing orders. Each customer has a customer number and profile (such as name, shipping address). To simplify the matter, each time an order is placed, only one...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT