create table PRODUCT(PRODUCTCODE VARCHAR(20),DESCRIPTION
VARCHAR(50),LISTPRICE numeric(10,2),DISCOUNTEDPRICE
numeric(10,2));
INSERT INTO PRODUCT VALUES("89-WRE-Q","Hicut chain saw,16
in.",256.99,239);
INSERT INTO PRODUCT VALUES("WR3/TT3","Steel
matting,4'x8'x1/6',.5''mesh",119.95,119.95);
INSERT INTO PRODUCT VALUES("11QER/31","Power painter,15
psi.,3-nozzle",109.99,109.99);
INSERT INTO PRODUCT VALUES("2232/QTY","B\&D jigsaw,12-in.
blade",109.92,102.23);
INSERT INTO PRODUCT VALUES("2232/QWE","B\&D jigsaw,8-in.
blade",99.87,92.88);
INSERT INTO PRODUCT VALUES("1558-QW1","Hrd.
cloth,1/2-in.,3x50",43.99,43.99);
alter table PRODUCT ADD COLUMN SELLINGPRICE NUMERIC(10,2);
UPDATE PRODUCT SET SELLINGPRICE=DISCOUNTEDPRICE*0.13 WHERE
DESCRIPTION LIKE '%hammer%';
UPDATE PRODUCT SET SELLINGPRICE=DISCOUNTEDPRICE*0.07 WHERE
DESCRIPTION LIKE '%saw%';
UPDATE PRODUCT SET SELLINGPRICE=LISTPRICE WHERE DESCRIPTION NOT
LIKE '%hammer%' OR DESCRIPTION NOT LIKE '%saw%';
select PRODUCTCODE,DESCRIPTION,LISTPRICE,SELLINGPRICE FROM
PRODUCT;
Query Description Salece hardware store has decided to sell some products on discount as described below:...
Using the ch08_saleco database write a T-SQL query to display the customer code, invoice number invoice date, and invoice subtotal from invoice conditioned on the invoice subtotal is greater than $100 and from only customer codes 10011 and 10012. (hint: in) /* Database Systems, 8th Ed., Rob/Coronel */ /* Type of SQL : SQL Server */ CREATE TABLE CUSTOMER ( CUS_CODE int, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT...
Create a stored procedure named prc_inv_amounts to update the INV_SUBTOTAL, INV_TAX, and INV_TOTAL. The procedure takes the invoice number as a parameter. The INV_SUBTOTAL is the sum of the LINE_TOTAL amounts for the invoice, the INV_TAX is the product of the INV_SUBTOTAL and the tax rate (8 percent), and the INV_TOTAL is the sum of the INV_SUBTOTAL and the INV_TAX /* Database Systems, Coronel/Morris */ /* Type of SQL : SQL Server */ /* WARNING: */ /* WE HIGHLY RECOMEND...
Create SQL statements based on the given tables:
Code to create the tables:
CREATE DATABASE LAB4DB;
USE LAB4DB;
CREATE TABLE CUSTOMER (
CUS_CODE int primary key,
CUS_LNAME varchar(15),
CUS_FNAME varchar(15),
CUS_INITIAL varchar(1),
CUS_AREACODE varchar(3),
CUS_PHONE varchar(8),
CUS_BALANCE float(8)
);
INSERT INTO CUSTOMER
VALUES('10010','Ramas','Alfred','A','615','844-2573','0');
INSERT INTO CUSTOMER
VALUES('10011','Dunne','Leona','K','713','894-1238','0');
INSERT INTO CUSTOMER
VALUES('10012','Smith','Kathy','W','615','894-2285','345.86');
INSERT INTO CUSTOMER
VALUES('10013','Olowski','Paul','F','615','894-2180','536.75');
INSERT INTO CUSTOMER
VALUES('10014','Orlando','Myron','','615','222-1672','0');
INSERT INTO CUSTOMER
VALUES('10015','O''Brian','Amy','B','713','442-3381','0');
INSERT INTO CUSTOMER
VALUES('10016','Brown','James','G','615','297-1228','221.19');
INSERT INTO CUSTOMER
VALUES('10017','Williams','George','','615','290-2556','768.93');
INSERT INTO CUSTOMER
VALUES('10018','Farriss','Anne','G','713','382-7185','216.55');
INSERT INTO CUSTOMER
VALUES('10019','Smith','Olette','K','615','297-3809','0');
/*...
All the required files are attached to this question here in the
form of images. Please refer the attached images and answer the
questions.
List the names and codes of vendors and the number of products
each vendor has supplied, i.e. vendor AA has supplied xxx products,
and vendor BB has supplied yyy products etc.
Show the total value of invoices for each customer with the
customer the Last Name, and a column heading showing
‘Total_invoice_value’ in the results.
List...
* 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...
CUSTOMER EMP INVOICE LINE P CODE V CODE CUS CODE EMP CODE NV NUMBER NV NUMBER, LINE NUMBER Create SQL queries for displaying the following results 5. List the customers who have ordered product bearing product code "23109-HB. Display first names, last names of customers, invoice numbers and product codes 6. Display Vendor details (V_CODE, V NAME) and product details (P CODE, P DESCRIPT) and product quantity on hand in excess of product min quantity (give alias of Quantity above...