Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

UID: 20BCA1170

Worksheet :8
Student Name : Raunak Kumar Upadhyay UID : 20BCA1507

Branch: BCA Section/ 3/


Group: A
Dateof 10/11/2021
Semester: 3rd Performance:

Subject Name: DBMS Subject 20cap215


lab Code:

1. Task to be done:
Create a table Products and its column are according to it.

• Prod_id .................................. Primary key


• Prod_name ................................. unique
• Prod_Description ................................... Not null
• Product_price ..........................check (price should
be more than 200)  Maufacturing_date .............................. Not null

Operation perform given in the worksheet:-

i) Enter any 10 values as per the table requirements and


perform the following queries:
UID: 20BCA1170

ii) Display all the details of the products

iii) Display the details of Products having price more than 500.
UID: 20BCA1170

iv) Sort the details of the Product in Descending Order

v) Implement the group by clause in Products Table


UID: 20BCA1170

2. Coding part:-

1. use bca;
2. create table products(prod_id int primary key,prod_name varchar(20)
unique,prod_description text not null, product_price int,
3. manufacturing_date date not null);
4. desc products;
5. select *from products;
6. insert into
products(prod_id,prod_name,prod_description,product_price,Manufacturing
_ date)values
7. (2,'Apple X','Smartphone',89000,'2017-12-3'),
UID: 20BCA1170

8. (3,'asus vivobook 14','Laptop',52000,'2019-5-23'),


9. (4,'mario lite','biscuit',300,'2012-2-2');
10.insert into
products(prod_id,prod_name,prod_description,product_price,Manufacturing
_ date)values
11.(5,'power od mind','book',210,'2002-4-3'),
12.(6,'elentila','chair',450,'2013-4-5'),
13.(7,'samsung','charger',850,'2013-3-2'),
14.(8,'woodcraft','table',1200,'2002-2-1'),
15.(9,'american tourister','bag',2500,'2003-3-4'),
16.(10,'j-12k3','jordan shoes',12999,'2004-5-21');
17.select *from products where product_price > 500;
18.select *from products order by prod_id desc;
19.select count(prod_name)as group_by_name ,product_price from products
group by product_price;

3. Learning outcomes (What I have learnt):


1. how to insert data in table
2. How to create a table
3. How to use group by function in sql
Evaluation Grid:

Sr. No. Parameters Marks Obtained Maximum Marks


1. Worksheet 10
2. Demonstration/Performance /Pre 5
Lab Quiz
3. Post Lab Quiz 5

You might also like