0% found this document useful (0 votes)
20 views3 pages

Task # 2 - Has Been Solved!!!!: SQL Scripts To Create Production Table: CREATE Table Production (

The document contains SQL scripts to create a Production table with fields for serial number, batch number, product code, machine time, assembly time, finish time, and cost. It also contains a SELECT query that calculates the average machine time, assembly time, finish time, and cost for each product code in the Production table and formats the cost average with a currency designator.

Uploaded by

Ankit Komar
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
0% found this document useful (0 votes)
20 views3 pages

Task # 2 - Has Been Solved!!!!: SQL Scripts To Create Production Table: CREATE Table Production (

The document contains SQL scripts to create a Production table with fields for serial number, batch number, product code, machine time, assembly time, finish time, and cost. It also contains a SELECT query that calculates the average machine time, assembly time, finish time, and cost for each product code in the Production table and formats the cost average with a currency designator.

Uploaded by

Ankit Komar
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 3

Task # 2 Has been Solved!!!!

SQL Scripts to Create Production Table:


CREATE Table Production
(
SerialNo varchar(20) NOT NULL,
BatchNo varchar(25),
ProductCode varchar(25),
MachineTime decimal(2,2),
AssemblyTime decimal(2,2),
FinishTime decimal(2,2),
Cost varchar(20)
);

SELECT
PRODUCTCODE, AVG(MACHINETIME) AS MACHINETIMEAverage,
AVG(ASSEMBLYTIME) AS ASSEMBLYTIMEAverage, AVG(FINISHTIME) AS
FINISHTIMEAverage ,to_char(AVG(to_NUMBER(SUBSTR(COST,2, LENGTH(COST)-1))),
'L000D000000') AS COSTAverage
FROM PRODUCTION
GROUP BY PRODUCTCODE;

SOLVE SQL PROBLEMS (TASK # 3 6)

You might also like