Lab 5 Report
Lab 5 Report
LAB REPORT 05
Roll No : (22-CP-72)
Semester : 6th
Section : OMEGA
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION
ENGINEERING
Lab Objective:
To understand SQL wild cards and the operators used in SQL.
Lab Tasks:
• Write an SQL statement that selects all Customers with a Country starting with
the letter
“s”.
SELECT * FROM customers_lab05
where country like 's%'
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA
FACULTY OF TELECOMMUNICATION AND INFORMATION
ENGINEERING
Write an SQL statement that selects all Customers with a Contact Name ending with
the letter “s”.
SELECT * FROM customers_lab05
where country like '%s'
Write an SQL statement that selects all Customers with a City containing the pattern
“ndo”.
SELECT * FROM customers_lab05
where country like '%ndo%'
Write an SQL statement that selects all Customers with a City not containing the
pattern “ndo”.
SELECT * FROM customers_lab05
where country not like '%ndo%'
Write an SQL statement that selects the two first Customers from table who belong
to “Germany” or “Sweden”.
SELECT top 2 * FROM customers_lab05
where country in ('Germany' , 'Sweden');
Write an SQL statement that selects all Customers with a City of "Paris" or "London"
without using ‘OR’ operator.
SELECT * FROM customers_lab05
where city in ('paris' , 'london');
unit varchar(255),
price decimal(5)
);
insert into products_lab05 values
(1, 'Chais', 1, 1, '10 boxes x 20 bags', 18),
(2, 'Chang', 1, 1, '24 - 12 oz bottles', 19),
(3, 'Aniseed Syrup', 1, 2, '12 - 550 ml bottles', 10),
(4, 'Chef Anton''s Cajun Seasoning', 1, 2, '48 - 6 oz jars', 22),
(5, 'Chef Anton''s Gumbo Mix', 1, 2, '36 boxes', 21.35);
select * from products_lab05
• Write an SQL statement that selects all products with a price from 10 to 20.
• Write an SQL statement that selects all products with a price from 20 to 30.
select * from products_lab05
where price between 20 and 30;
• Write an SQL statement that selects all products with a price from 10 to 22 but
products with a CategoryIDof 1,2, or 3 should not be displayed.