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

(Or Where Tblitems - Item - Category in ("Hygiene") )

The document provides 10 SQL queries to retrieve data from tables in a dbSales database. The queries select column data from tables tblCustomer and tblItems based on various filtering criteria like province, name, item category, price, quantity, supplier code and expiry date. The data is also sorted by expiry date in one query.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

(Or Where Tblitems - Item - Category in ("Hygiene") )

The document provides 10 SQL queries to retrieve data from tables in a dbSales database. The queries select column data from tables tblCustomer and tblItems based on various filtering criteria like province, name, item category, price, quantity, supplier code and expiry date. The data is also sorted by expiry date in one query.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Using dbSales in your computer, create the following queries.

1. Display the Fname, Lname and Province of the customers from the
tblCustomer who are from Laguna.

Select tblCustomer.Fname, tblCustomer.Lname,


tblCustomer.ProvinceFrom dbSales.tblCustomer
Where tblCustomer.Province = “Laguna”;

2. Display the Fname and Lname of the customers from the tblCustomer
who Fname has letter ‘a’ on it.

Select tblCustomer.Fname, tblCustomer.Lname


From dbSales.tblCustomer
Where tblCustomer.Fname LIKE ‘%a%’;

3. Display the Item_Desc, Qty and Selling Price of all items in tblItems.

Select Item_Desc, Qty, SellPrice


FROM tblItems;

4. Display the Item_Desc and Qty of items in tblItems with the Category
“Hygiene”.
Select tblItems.Item_Desc, tblItems.Qty
FROM tblItems
Where tblItems.Item_Category = “Hygiene”;
[or
Where tblItems.Item_Category IN(“Hygiene”);]

5. Display the Item Description, Category and Selling Price of the items in
tblItems that has a Selling Price less than 50.

Select Item Description, Category, Selling Price


From tblItems
Where SellPrice < 50;

6. Display the Item Description, Quantity and Unit Price of the items in
tblItems that has a Unit Price greater than 75.

Select Item Description, Quantity, Unit Price


From tblItems
Where UnitPrice >75;

7. Display the Item Description, Category and Quantity of the items in


tblItems that has Quantity over 50 and where Expiry Date is until the
end of this year.

Select Item Description, Category, Quantity


From tblItems
Where Quantity >50 AND Exp_Date= 31-Dec-18;

8. Display the Item Description and Total_Price of each item in tblItems by


multiplying the Quantity and Selling_Price.

Select Item Description, Quantity * Selling_Price AS Total_Price


From tblItems;

9. Display the Item Description, Quantity and Expiry Date of the items in
tblItems whose Supplier_Code is 1,3,5.

Select Item Description, Quantity, Expiry Date


From tblItems
Where Supplier_Code IN(1,3,5);

10. Sort the data from tblItems according its Expiry Date.

Select * from tblItems


Order by Exp_Date;

You might also like