0% found this document useful (0 votes)
78 views

Assignment 7 Lab Solution

The document provides the steps to create indexes on tables, create composite indexes, create views, select from a view, and drop indexes and views. It creates indexes on fields in tables like client_master, sales_order, and salesman_master. It creates composite indexes on sales_order_details and challan_header tables. Views are created on salesman_master and client_master tables and data is selected from the client_master view. Indexes and views are dropped as specified.

Uploaded by

aditya b
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Assignment 7 Lab Solution

The document provides the steps to create indexes on tables, create composite indexes, create views, select from a view, and drop indexes and views. It creates indexes on fields in tables like client_master, sales_order, and salesman_master. It creates composite indexes on sales_order_details and challan_header tables. Views are created on salesman_master and client_master tables and data is selected from the client_master view. Indexes and views are dropped as specified.

Uploaded by

aditya b
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 7 lab solution

i) Create an index on the table client_master, field client_no

CREATE INDEX SYS_C0012103ON CLIENT_MASTER(CLIENT_NO);


ii) Create an index on the sales_order, field s_order_no.
CREATE INDEX SYS_C0012070ON SALES_ORDER(S_ORDER_NO);

iii.) Create an composite index on the sales_order_details table for the columns
s_order_no and product_no.
CREATE INDEX PK_SODON SALES_ORDER_DETAILS(S_ORDER_NO,PRODUCT_NO)

;iv).Create
an composite index ch_index on challan_header table for the columns challan no
and s_order_no.
CREATE INDEX CH_INDEXON CHALLAN_HEADER (CHALLAN_NO,S_ORDER_NO)

;v).Create an uniQuestion index on the table salesman_master, field salesman_no.


CREATE UNIQUE INDEX SYS_C0012063ON SALES_MASTER (SALESMAN_NO);

vi)Drop index ch_index on table challan_header.

DROP INDEX CH_INDEX;

vii).Create view on salesman_master whosesal_amt is less than 3500


CREATE VIEW SPSAL ASSELECT * FROM SALES_MASTERWHERE SALES_MASTER.SAL_AMT
<3500;

viii).Create a view client_view on client_master and rename the columnsas name, add1, add2,
city, pcode, state respectively

CREATE VIEW CLIENT_VIEW AS SELECT CLIENT_MASTER.CLIENT_NO AS


CNO,CLIENT_MASTER.NAME AS CNAME, CLIENT_MASTER.ADDRESS1 AS
ADD1,CLIENT_MASTER.ADDRESS2 AS ADD2, CLIENT_MASTER.BAL_DUE AS
BD,CLIENT_MASTER.CITY AS CCITY,CLIENT_MASTER.STATE CSTATE,
CLIENT_MASTER.PINCODE PCODE,CLIENT_MASTER.PHONE_NO AS PH FROM CLIENT_MASTER;

ix) Select the client names from client_view who lives in city ‘Bombay’.

SELECT * FROM CLIENT_VIEW WHERE CCITY IN 'Bombay';

x).Drop the view client_view.


DROP VIEW CLIENT_VIEW;

You might also like