MS Access SQL Commands
MS Access SQL Commands
Queries:
Lets say we import the following table into MS- Access:
Below are the type of queries we did in class along with description for each.
Query Explanation
SELECT ITEM FROM InventorySchool; Displays all rows only for Item column
SELECT PRICE AS COST FROM Displays all rows only for Price column
InventorySchool; from InventorySchool table. In the
output, Price column will be named as
COST
Query Explanation
SELECT * FROM InventorySchool Displays all rows and all columns but
WHERE PRICE>3; only with price values more than 3
SELECT ITEM FROM InventorySchool Displays only rows for Item column
WHERE QuantityInStock <50; where the quantityInStock is less than
50
SELECT ITEM, CATEGORY FROM Displays only item and category column
InventorySchool with rows that only are in Southeast or
WHERE CAMPUS=’Southeast’ or Sports campuses.
CAMPUS= ‘Sports’;
AGGREGATE FUNCTIONS
Query Explanation
SELECT SUM(Price) AS TotalPrice Displays the sum total of all the values
FROM InventorySchool; in the price column,. The result is
labeled as ‘TotalPrice’
Query Explanation
INSERT INTO Colleges (ID,Name, Inserts a row of data into the table
Location) VALUES (‘9’, ‘Manipal Colleges.
University’, ‘Karnataka’);