0% found this document useful (0 votes)
4 views4 pages

dbms_lab4

The document outlines an assignment for a Database Management System (DBMS) lab, detailing the creation of two tables: Challan_Header and Challan_Details, along with their respective columns and constraints. It includes SQL commands for inserting data into these tables and modifying existing tables, such as adding primary keys and constraints. Additionally, it provides queries for selecting specific data based on conditions set in the assignment questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

dbms_lab4

The document outlines an assignment for a Database Management System (DBMS) lab, detailing the creation of two tables: Challan_Header and Challan_Details, along with their respective columns and constraints. It includes SQL commands for inserting data into these tables and modifying existing tables, such as adding primary keys and constraints. Additionally, it provides queries for selecting specific data based on conditions set in the assignment questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: Harsh Singh

Roll No: 2100290110061

ASSIGNMENT 4 (DBMS LAB


3)
Question 1. Create the following tables:

Challan_Header
Column name data type size Attributes
Challan_no varchar2 6 Primary key
s_order_no varchar2 6 Foreign key references s_order_no of

sales_order table
challan_date date not null
billed_yn char 1 values (‘Y’,’N’). Default ‘N’

Table Name : Challan_Details


Column name data type size Attributes

Challan_no varchar2 6 Primary key/Foreign key references


Product_no of product_master
Qty_disp number 4,2 not null

Q2. Insert the following values into the challan header and challan_details tables:

(i) Challan No S_order No Challan Date Billed

CH9001 019001 12-DEC-95 Y


CH865 046865 12-NOV-95 Y

CH3965 010008 12-OCT-95 Y

Data for challan_details table

Challan No Product No Qty Disp


CH9001 P00001 4
Name: Harsh Singh
Roll No: 2100290110061

CH9001 P07965 1

CH9001 P07885 1

CH6865 P07868 3

CH6865 P03453 4

CH6865 P00001 10

CH3965 P00001 5
CH3965 P07975 2
Objective – Answer the following Questionries

Q1. Make the primary key to client_no in client_master.

Q2. Add a new column phone_no in the client_master table.

Q3. Add the not null constraint in the product_master table with the columns description,
profit percent , sell price and cost price.

Q4. Change the size of client_no field in the client_master table.

Q5. Select product_no, description where profit percent is between 20 and 30 both
inclusive.
Name: Harsh Singh
Roll No: 2100290110061

SOLUTION:
Ques1: ALTER TABLE client_master ADD
PRIMARY KEY (client_no);

Ques 2: ALTER TABLE client_master


ADD phone_no varchar2(15); Ques3:

ALTER TABLE product_master


MODIFY description varchar2(255) NOT NULL;

ALTER TABLE product_master


MODIFY profit_percent number(5,2) NOT NULL;

ALTER TABLE product_master


MODIFY sell_price number(10,2) NOT NULL;

ALTER TABLE product_master


MODIFY cost_price number(10,2) NOT NULL;
Ques4:
Name: Harsh Singh
Roll No: 2100290110061

ALTER TABLE client_master


MODIFY client_no varchar2(10);
Ques5:
SELECT product_no, description
FROM product_master
WHERE profit_percent BETWEEN 20 AND 30;

You might also like