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

SQL Syntax

The document outlines the creation of a database table named 'fabric_order_details' to manage order information in a weaving factory, including fields such as order code, customer name, fabric code, width, color, quantity, and delivery date. It provides SQL commands for inserting data into the table and querying specific information, such as orders with quantities over 3000 meters and fabric codes with widths less than 100 cm. Additionally, it mentions aggregate functions like SUM, COUNT, and AVG for further data analysis.

Uploaded by

Soumo Chowdhury
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

SQL Syntax

The document outlines the creation of a database table named 'fabric_order_details' to manage order information in a weaving factory, including fields such as order code, customer name, fabric code, width, color, quantity, and delivery date. It provides SQL commands for inserting data into the table and querying specific information, such as orders with quantities over 3000 meters and fabric codes with widths less than 100 cm. Additionally, it mentions aggregate functions like SUM, COUNT, and AVG for further data analysis.

Uploaded by

Soumo Chowdhury
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Paper Code: PE TT701C (IT and CAD/CAM in

Textile Industry) and PE TT791C (Lab on IT and


CAD/CAM in Textile Industry)
PC APM 602 , PC APM692
22nd November 2021
19TH Feb 2022

DDL

CREATE TABLE table_name(


column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns )
);

Task: To construct a standard Database Table for the details of orders received in a weaving
factory: (Fabric_order_details)

CREATE TABLE fabric_order_details(

Order_code char[6],

Cust_name char[10],

Fab_code char[5],

Fab_width_cm num[3],

Fab_color char[7],

Order_qty_mtr num[6],

Delivery_date date[9],

PRIMARY KEY (Order_code)

);
Table Name: fabric_order_details

Order_code Cust_name Fab_code Fab_width_cm Fab_color Order_qty_mtr Delivery_


date
AP2236 WALMART POP23 120 TURQ0112 5000 31/01/20
21
AP3345 IKEA Jacq34 100 FUSC1123 1000
AP2278 KMART Sat45 90 PURP0099 5000
XP9087 BLACKBERR POP23 120 IVR3344 10000
Y
1000

SQL INSERT INTO Statement


INSERT INTO table_name( column1, column2....columnN)
VALUES ( value1, value2....valueN);

INSERT INTO fabric_order_details (Order_code, Cust_name , Fab_code , Fab_width_cm , Fab_color,


Order_qty_mtr , Delivery_date)

VALUES (AP2236, WALMART, POP23, 120, TURQ0112, 5000,31/01/2021)

VALUES ( )

------

------

------

SELECT
Qr-1: Show the customer name, order code and fabric code for the order quantity more than 3000
mtr

SELECT Cust_name , order_code , fab_code

FROM fabric_order_details

WHERE (Order_qty_mtr>3000);

QR-2: Show all the fabric codes and delivery date for the fabric width less than 100 cm
Qr-3: Show the fabric code wise total order

SELECT SUM(Order_qty_mtr)

FROM fabric_order_details

GROUP BY fab_code

ORDER BY Order_qty_mtr(ASC)

More functions: COUNT( ) , AVG( ) , Max( ) , Min( ) , Stdev ( ) etc.

QR-1/19th Feb 2022: show all the style code and fabric consumption for all the 100%
cotton Blended garmemnts from the table Garment_Style_Details

QR-2/19th Feb 2022: Show the style number wise total order quantities from the
garment_order_details table and show the output in the descending order of the order
quantity

You might also like