Question: CREATE TABLE VENDOR ( V_CODE int, V_NAME varchar(15), V_CONTACT varchar(50), V_AREACODE varchar(3), V_PHONE varchar(8), V_STATE varchar(2), V_ORDER varchar(1 CREATE TABLE PRODUCT ( P_CODE varchar(10), P_DESCRIPT
CREATE TABLE VENDOR ( V_CODE int, V_NAME varchar(15), V_CONTACT varchar(50), V_AREACODE varchar(3), V_PHONE varchar(8), V_STATE varchar(2), V_ORDER varchar(1
CREATE TABLE PRODUCT ( P_CODE varchar(10), P_DESCRIPT varchar(35), P_INDATE varchar(35), P_QOH int, P_MIN int, P_PRICE float(8), P_DISCOUNT float(8), V_CODE int
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) );
CREATE TABLE INVOICE ( INV_NUMBER int, CUS_CODE int, INV_DATE varchar(35), INV_SUBTOTAL float(8), INV_TAX float(8), INV_TOTAL float(8) );
CREATE TABLE LINE ( INV_NUMBER int, LINE_NUMBER int, P_CODE varchar(10), LINE_UNITS float(8), LINE_PRICE float(8), LINE_TOTAL float(8) );
CREATE TABLE EMP ( EMP_NUM int, EMP_TITLE varchar(4), EMP_LNAME varchar(15), EMP_FNAME varchar(15), EMP_INITIAL varchar(1), EMP_DOB varchar(35), EMP_HIRE_DATE varchar(35), EMP_AREACODE varchar(3), EMP_PHONE varchar(8), EMP_MGR int ); using above tables
Write and run SQL statements to complete the following tasks:
-
Show the details of the employee/s where the manager (emp_mrg) of the employee is 100 and age of the employee at hire date is greater than 30 (3 marks),
-
Show the managers (emp_mrg) and the number of employees under each manager (2 marks),
-
Show the manager (emp_mgr) who has the highest the number of employees (2 marks),
-
Show the customer code (cus_code) whose total investment (inv_total) is greater than 100 and less than 1000 (2 marks),
-
Show the customer details who has the highest investment (inv_total) (2 marks),
-
Show the details of the products where the minimum price of the product is less than 20 and the vender code (v_code) is 21225 (2 marks),
-
Show the product details that has the highest line price (line_price) (3 marks).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
