Computers and Technology

Question 1CorrectMark 1.00 out of 1.00Which of the following includes a set of commands used to control access to the data within the database, including security?Select one:a. DMLb. DALc. DCLd. DDLYour answer is correct.The correct answer is: DCLCreate Table SALE(SaleID integer,SaleDate date,Tax decimal,Total decimal);Create Table ITEM(ItemID integer,Name char(30),Cost decimal,Price decimal);Create Table SALE_ITEM(SaleID integer,SaleItemID integer);Considering the SQL create statements; assume that SALE, SALE_ITEM and ITEM tables were created without Primary Keys and Foreign Keys.Which of the following SQL statements gives an error?Select one:a. Alter Table SALE Add Primary Key (SaleID);Alter Table SALE_ITEM Add Primary Key (SaleID, SaleItemID);Alter Table SALE_ITEM Add Unique (SaleID);Alter Table ITEM Add Primary Key (ItemID);Alter Table SALE Add Foreign Key (SaleID) References SALE_ITEM;b. Alter Table SALE Add Primary Key (SaleID);Alter Table SALE_ITEM Add Primary Key (SaleID, SaleItemID);Alter Table SALE_ITEM Add Unique (SaleID);Alter Table SALE Add Foreign Key (SaleID) References SALE_ITEM (SaleID);c. Alter Table ITEM Add Primary Key (ItemID);Alter Table SALE_ITEM Add Primary Key (SaleID, SaleItemID);Alter Table SALE_ITEM Add Unique (SaleID);Alter Table ITEM Add Foreign Key (ItemID) References SALE_ITEM;d. Alter Table SALE Add Primary Key (SaleID);Alter Table SALE Add Foreign Key (SaleID) References SALE_ITEM;Your answer is incorrect.The correct answer is: Alter Table ITEM Add Primary Key (ItemID);Alter Table SALE_ITEM Add Primary Key (SaleID, SaleItemID);Alter Table SALE_ITEM Add Unique (SaleID);Alter Table ITEM Add Foreign Key (ItemID) References SALE_ITEM;
Maximum Discount Product A department store maintains data on customers, products and purchase record in three tables CUSTOMER PRODUCT, and PURCHASE. The store manager wants to know which product is on maximum discount for each category. Write a query to print the following fields for each category, ordered by category, ascending Category, product ID and discourse for the product that has the maximum discoun in the category. In the case of multiple products having same maximum discount within a category, print the product with minimum product_id Table Schema CUSTOMER Name Type Description CUSTOMER_ID Integer A customer's ID in the inclusive range 1 S00). This is a primary key CUSTOMER NAME String A customer's name. This field contains between 1 and 100 characters (inclusive) RE 2% NTSC al 14 17 ESC N o DI D- Q $ A % 5 N 3 6 CUSTOMER Name Description Type A customer's iD in the inclusive range 11 500). This is a primary CUSTOMER ID Integer key. CUSTOMER_NAME String A customer's name. This field contains between 1 and 100 characters (inclusive) CITY String A city name. This field contains between 1 and 50 characters (inclusive) STATE String A state name. This field contains between 1 and 50 characters (inclusive) PRODUCT Name Type Description NTSC 12 & 15 TI Z" 2 A $ 4 % 5 3 un 6 Lo N Description PRODUCT_ID Integer Aproucts in the inclusive range, 500). This is a primar key PRODUCT_NAME String A product's name. This field contains between 1 and 50 characters (inclusive) A category name of the product. This field contains between 1 and 50 characters (inclusive) The price of the product in the inclusive range