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

SQL Lab Sample 2

The document outlines SQL queries for retrieving data from two tables: Sales and Products, as well as a STUDENT table. It includes tasks such as filtering sales based on total price, retrieving specific columns from the Products table, and displaying student details based on department and marks criteria. The queries are organized into questions with sub-questions focusing on different filtering conditions.

Uploaded by

poonam.shah
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)
2 views3 pages

SQL Lab Sample 2

The document outlines SQL queries for retrieving data from two tables: Sales and Products, as well as a STUDENT table. It includes tasks such as filtering sales based on total price, retrieving specific columns from the Products table, and displaying student details based on department and marks criteria. The queries are organized into questions with sub-questions focusing on different filtering conditions.

Uploaded by

poonam.shah
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

Given Table

Create table and insert values in it:


1. Retrieve all columns from the Sales table.
2. Retrieve the product_name and unit_price from the
Products table
3. Filter the Sales table to show only sales with a
total_price greater than $100.
4. Retrieve the sale_id and total_price from the Sales table
for sales made on January 3, 2024.
[Link] the product_id and product_name from the
Products table for products with a unit_price greater than
$100.

Given Table

STUDENT(
sid INT,
sname VARCHAR(30),
dept VARCHAR(20),
semester INT,
marks INT
)
Question 1 (5 Marks)
a) Display all details of students who belong to the CSE
department.
b) Display names and marks of students who scored more than
80 marks.
c) Display details of students who are in semester 5.
Question 2 (5 Marks)
a) Display student id and name of students whose marks are
less than 50.
b) Display details of students who belong to IT department and
semester 3.
c) Display students whose marks are between 60 and 75.
Question 3 (5 Marks)
a) Display details of students who do not belong to CSE
department.
b) Display names of students who scored exactly 90 marks.
c) Display details of students whose student id is 10.
Question 4 (5 Marks)
a) Display names and departments of students who scored
more than 70 and belong to ECE department.
b) Display students who scored less than or equal to 40 marks.
c) Display details of students whose department is MECH.

You might also like